In JUnit 5, how to run code before all tests

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

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:

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: