jeudi 28 janvier 2016

Using test rules for JUnit3 TestCase

First of all let me explain the test setup,

I work for this very large project which has many smaller modules. And to test, we use JUnit in two ways,

  • JUnit 4: With @Test annotation and we use a custom test runner that derives from BlockJunit4ClassRunner
  • JUnit 3: We a large chunk of tests those are dynamically created from XML files and are based on junit.framework.TestCase. We have a custom test runner for this too that inherits org.junit.runners.AllTests.

For some cross cutting non-functional requirements we have implemented some rules (org.junit.rules) which we use through annotating the test class using @Rule. This works well for JUnit4 but not JUnit3.

Is there a straight forward way of implementing it without making too many changes?

Aucun commentaire:

Enregistrer un commentaire