-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
ctg-bugIssue is a bugIssue is a bugstatus-help-wantedExtra attention is neededExtra attention is needed
Description
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
- Run a project in IntelliJ Idea 2022.1.3 - 2022.2.2
- Install RC plugin build
- Set Fuzzing to 100% (in File -> Settings -> Tools -> UnitTestBot)
- Generate tests with UnitTestBot for utbot-sample/src/main/java/org/utbot/examples/mock/MockRandomExamples.java
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:
///region FUZZER: SUCCESSFUL EXECUTIONS for method useSecureRandom()
@Test
@DisplayName("useSecureRandom: arg_0 = MockRandomExamples() -> return 1")
public void testUseSecureRandomReturnsOne() {
MockRandomExamples mockRandomExamples = new MockRandomExamples();
int actual = mockRandomExamples.useSecureRandom();
assertEquals(1, actual);
}
///endregion
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.2
Additional context
Originally posted by @alisevych in #1102 (comment)
Metadata
Metadata
Assignees
Labels
ctg-bugIssue is a bugIssue is a bugstatus-help-wantedExtra attention is neededExtra attention is needed
Type
Projects
Status
Todo