I have a question about how to handle tearDown of JUnit tests (in Gradle) when you have multiple test classes.
Here is the problem:
- JUnit doesn’t have a @AfterSuite annotation like TestNG has for test groups. 2. The @AfterClass annotation works fine where all your tests are in one single class but that is not my question. 3. If you have multiple JUnit classes , each with their own set of tests, and all of the classes need to share a
static object of some kind, such as a web browser object, in that case the tearDown in @AfterClass would destroy
the static object between classes which isn’t acceptable for performance reasons. Destroying and recreating an
object over and over again unnecessarily is inefficient.
So, how can Gradle solve this issue for me?
Is the Gradle JUnit Runner capable of something similar to @AfterSuite ?