Trying to understand the relation between parallel execution and junit lifecycle methods #3654
pratyushdeshpande
started this conversation in
General
Replies: 1 comment
-
You seem to misunderstand what extending a class does. Your test class, by extending the base class will have all the methods and fields of the base class. So JUnit will when executing a test method of a class, first execute all the available before methods on that class. Including those inherited from the base class. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am using Junit 5 Jupiter and maven surefire plugin in my project
I have 4 Test classes with many methods inside it. Each Test class extends a Base Class where BeforeAll , After All, Before Each and After Each methods are implemented.
I have implemented Custom Strategy for eg: should run parallel with 4.
Also, in the maven pom under Surefire plugin , I mentioned the classes and methods should run parallel and also the same execution mode concurrent for methods and classes.
Now while running the tests, the before ALL method and after All method also runs 4 times in 4 separate threads. I though beforeAll and AfterALL will execute only once. Why is that , and what is relation and how do I resolve the issue ?
Beta Was this translation helpful? Give feedback.
All reactions