Inconsistent Behavior of Java Unit Tests Across Environments

107 Views Asked by At

I have encountered an issue where several unit tests in my Java project exhibit inconsistent behavior across different environments. Specifically, some tests fail in the testing environment (as part of the Jenkins build), while the same tests pass in the local development environment. Furthermore, these tests pass again when executed in another environment, such as the QA environment. It is worth noting that the tests were written using JMockit version 1.20, Mockito version 2.8.0, and JUnit 4.12 and build are taken using gradle 4.8.

Why would tests behave differently for different environment when its same and running on same configurations

1

There are 1 best solutions below

0
Suresh Kumar On

Check whether is there any order to be maintained across the Tests. Means you have to define which order the Test methods to be executed. Sometime earlier,we had faced this issue somewhere. Just check it out