-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuzzing is generating a false test for Random #1135
Comments
@korifey @denis-fokin @Markoutte |
We should definitely reproduce every test, traversed by concrete executor. My proposal is to enhance concrete executor. It must automatically fixate behavior of certain methods and return back information to engine information about it. |
Also need to find Random usages. @korifey Would it be too long to rerun every test generated by Fuzzing? - to check if received data is changing from run to run |
Also, there is the same problem with Random when generating tests for vertexSum method from recursion package.
One (the test below) of the two generated tests will fail when running because of Random usage inside vertexSum method. ///region FUZZER: SUCCESSFUL EXECUTIONS for method vertexSum(int)
/**
* @utbot.classUnderTest {@link Recursion}
* @utbot.methodUnderTest {@link Recursion#vertexSum(int)}
*/
@Test
@DisplayName("vertexSum: n = 134217732 (mutated from 4) -> return 293591018")
public void testVertexSum() {
Recursion recursion = new Recursion();
int actual = recursion.vertexSum(134217732);
assertEquals(293591018, actual);
}
///endregion |
Description
Fuzzing is generating a test for Random without mocks - when Mock everything outside class is checked.
The test asserts the value returned by Random and fails.
To Reproduce
for useSecureRandom() - check Mock everything outside class.
Expected behavior
There should be only valid tests generated.
Possible solutions
Fuzzer can use mock Random(?)
Generated tests should be double-checks that they return same results(?)
other solution(?)
Actual behavior
Fuzzing is generating a test for Random without mocks. It asserts the value returned by Random and fails.
Visual proofs
The following test is generated by Fuzzer:
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.2
Additional context
Originally posted by @alisevych in #1102 (comment)
The text was updated successfully, but these errors were encountered: