small medium large xlarge

28 Oct 2015, 16:37
Chuck Boecking (1 post)

Hi Jeff and team,

Thank you for writing the book!! I have enjoyed reading it. I have the task to create a functional test suite for an open source ERP (iDempiere). My first question is: “Is JUnit the correct testing tool for my needs?”. Here are the details/questions:

  • It is an OSGi application, this means that my test suite will be a plugin to a much bigger system. It also means that I need to execute my test via the ‘JUnit Plugin Test’. There does not seem to by much documentation about this concept.

  • All the tests will depend on an initialization of the system. Each initialization take about 2 second to create (load resources, populate context, create session, etc…). Even if you perform this process in a @BeforeClass method, each class will have a substantial overhead. Is there a tool/hook to initialize the system before the Test Suite is executed?

  • Just about everything functional task that happens results in a record created in the database. This also means that the test will assert against the existence and accuracy of these records.

  • The @Before of our functional test can be very involved. An extreme example would be to test an inventory replenish process where you need to create and process 2 Physical Inventory documents, 10 POs, 8 Material Receipts documents, 3 Invoice documents, Run the replenish process, then check to make sure all expected conditions (resulting records) are present and accurate. My gut tells me this violates some if not all the principles in your book; however, this test is very much needed as described.

My hope in writing this post is that you can quickly give me a go / no-go answer and potentially save me a lot of time in determining if JUnit is the right solution. Thank you for taking the time to read!!

Regards, Chuck Boecking

18 Jan 2016, 20:24
Jeff Langr (23 posts)

hi Chuck–

My apologies for not seeing this earlier. PragProg is just now putting in a notification scheme for forum postings, so hopefully this won’t happen again.

JUnit would suffice, but you might take a look at TestNG, which gives you a bit more control over integration-oriented tests.

My take, though, would be to have a small number of integration tests that required the initialization to take place. The remainder and vast majority of tests would be unit-focused, i.e. to test the logic in isolation.

Personally I would use JUnit, but you should probably explore TestNG for yourself for a while.


You must be logged in to comment