In JUnit 5, how to run code before all tests

The @BeforeAll annotation marks a method to run before all tests in a class.

http://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations

But is there a way to run some code before all tests, in all classes?

I want to ensure that tests use a certain set of database connections, and the global one-time setup of these connections must occur before running any tests.



Read more here: https://stackoverflow.com/questions/43282798/in-junit-5-how-to-run-code-before-all-tests

Content Attribution

This content was originally published by Rob N at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: