0

I guess I need someone with extensive knowledge to solve my current problem:

I use Eclipse to debug jUnit-tests that use Unitils. While debugging, some or all of the tables in my database are locked, even though they are not accessed at the moment.

The result is, that other developers working on the same database are unable to run tests as long as I'm debugging (or vice versa).

Logically I don't see a reason, why the tables should be locked the whole time. So, should I try to deactivate locking? Do you know how to configure that?

Though I can think of alternative approaches, I'd really like to have these questions answered, for this would be the most convenient solution.

EDIT: The tests run on an Oracle DB with empty tables. Before each test, Unitils empties EVERY table (unusual configuration for Unitils) and then inserts specific test data. All constraints are active, which again, is an unusual configuration. When I'm debugging and another developer starts a jUnit-Test, their IDE freezes until they get a DB timeout or I stop debugging, due to Unitils trying to empty the tables again.

Thomas
  • 624
  • 11
  • 28
  • 1
    Which DBMS are you using? Oracle? PostgreSQL? –  Feb 01 '13 at 08:21
  • Oracle, via JPA. Shouldn't matter though. – Thomas Feb 01 '13 at 10:45
  • It matters a lot actually, because some DBMS impose more locking than others. e.g. in MySQL/MyISAM an update of a single row will lock the whole table, in SQL Server a (read-only) SELECT will block all retrieved rows from being updated from other sessions and so on. Do you actually *see* table locks when you e.g. query `V$LOCK`? What does the application or the test environment do when you start it? It's nearly impossible to answer your question without more details what your tests are doing during startup. –  Feb 01 '13 at 10:48
  • I would strongly urge you _not_ to run unit tests against a live database. It's much better/faster/easier to run tests against a mocked database. – ryan1234 Feb 01 '13 at 17:30
  • Ok, will query the data dictionary next time to find out. See EDIT for more details. – Thomas Feb 06 '13 at 19:36
  • I agree with @ryan1234. Is there a strong reason why everyone has to use the same database? – Miserable Variable Feb 06 '13 at 20:02

1 Answers1

0

Solution: Stopped using Unitils. DBUnit alone is enough and this problem is gone. Though this decision was made, because Unitils is no longer supported.

Thomas
  • 624
  • 11
  • 28