Question

I'm working on an application with an public api for which is thoroughly tested with a lot of JUnit 3 tests. There have been some changes and there are now two initial configuration setups to test. I would like to just run all test suites with each configuration, but based on initial conditions a small set of api methods now behaves differently. I would like to implement some annotations or use assumptions to toggle test methods, but I am actually stuck on Java 1.4 so annotations and JUnit 4 are out of reach ...

Any ideas how to progress from here? I would like to avoid splitting classes or moving methods around due to semantic reasons.

A note: those tests are not trivial, just configuring expected results on configuration does not work.

Of course I could do something like

public testAbc() {
  if (cond) 
      testAbc0();
  else 
      testAbc1();
}

but this strikes me as rather ugly.

Was it helpful?

Solution

Even if your deployment has to target 1.4, consider using a later release for your tests (e.g. Different maven compiler versions for test and main).

This will allow you to deploy binaries that were compiled with a 1.4 JDK and still take advantage of any later features in test frameworks, as well as building experience with current Java to prepare for a production upgrade.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top