Changing sequence of JUnit gives random errors

76 views Asked by At

I have a set of JUnit test cases in various packages. When I put them together in a test suite in a sequence it passes all the test cases. However, when I change their sequence the ones that have @ContextConfiguration fail with application context errors.

I could analyse that they seem to be failing because of @BeforeClass method that I have defined in my test cases Since, it loads all the static method in a separate utility class for those test cases. But I am not able to analyze why just mere changing the sequence is fixing everything for me. Also, changing their sequence permanently wont help either as ideally the order in which they are being executed should not be a matter of concern as all should be independent. And we cant control on jenkins which test to execute first. Please help.

0

There are 0 answers