You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong mocking for fields in Concrete Execution #2105
When generating tests for the ClassUsingClassWithRandomField#useClassWithRandomField method (with no mocking strategy but with java.util.Random included to mockAlways classes), the symbolic engine mocks constructors of the java.util.Random class and its method nextInt. So, the value returned from the MUT should equal the value returned by the mocked method nextInt. But in the concrete execution the random field becomes not mocked, which leads to using the real nextInt method and a diversion with the symbolic engine, and, as a result, an incorrect test.
To Reproduce
Run generating tests action for the method useClassWithRandomField with no mocks strategy but with java.util.Random included to mockAlways classes
Run a generated test.
Expected behavior
Generated test always passes.
Actual behavior
Almost always (sometimes the real nextInt value may return the same value as what is supposed to be mocked) generated test fails.
Activity