I have the following problem with JUnit 5. I want to run a test 15 times, so i used the Annotation @RepeatedTest(15)
and it worked. But the problem is, that in every run it calls @BeforeEach
Method and @AfterEach
Method.
Its doing this for all 15 loops, but it should only call @BeforeEach
before the first run and @AfterEach
after the last run. I think i cant use @BeforeAll
and @AfterAll
because i have multiple Tests, so this would only be called before Test 1 and Test 50 for example.
How it runs at the moment:
@BeforeAll Method
Test 1:
- @BeforeEach Method
- Run1
- @AfterEach Method
- @BeforeEach Method
- Run2
- @AfterEach Method
Test 2:
- @BeforeEach Method
- Run1
- @AfterEach Method
- @BeforeEach Method
- Run2
- @AfterEach Method
@AfterAll Method
How it should run:
@BeforeAll Method
Test 1:
- @BeforeEach Method
- Run1
- Run2
- @AfterEach Method
Test 2:
- @BeforeEach Method
- Run1
- Run2
- @AfterEach Method
@AfterAll Method
Aucun commentaire:
Enregistrer un commentaire