I am trying to executes some tests using JUnit 5 Test Suite. Based on the documentation I found, I used @RunWith and @SelectPackages (from the dependency junit-platform-runner).
Before I started the tests defined in the @SelectPackages, I wanted to load some properties file in such a setup method. I tried using @BeforeAll, @ClassRule and @Rule, but those setup methods are only called in any test methods in the annotated class (RemoteTests). But the setup methods are not called before the executions of the test classes defined in the @SelectPackages (com.test.packages).
@RunWith(JUnitPlatform.class)
@SelectPackages("com.test.packages")
public class RemoteTests {
@Rule // I tried also @ClassRule and @BeforeAll here
public void setup() {
PropertiesLoader.loadProperties("remote.properties");
}
}
Are there any setup annotations for my purpose?
@RunWith(it has@ExtendWith) nor@Rule. Maybe you are mixing annotations with JUnit4? - pirho@BeforeClass,@ClassRule,@BeforeAll, but nothing helped :( - Heru Salim