Open
Description
Description (abstract example)
When using Seed.Recursive
with modification X
, fuzzer doesn't attempt to apply modification X
more than once.
Real world (concrete) example
To cover last line of OwnerController#processFindForm
method in spring-petclinic
project we need to apply orderRepository.save(Owner)
modification twice in order to make both ownersResults.isEmpty()
and ownersResults.getTotalElements()
conditions fail.
To Reproduce
Run the following unit test.
@Test
fun `fuzzer can generate value without two repeated mutations`() {
runBlocking {
var seenRepeated = false
withTimeout(1000) {
runFuzzing(
{ _, _ -> sequenceOf(Seed.Recursive<Unit, StringBuilder>(
construct = Routine.Create(emptyList()) { StringBuilder("") },
modify = sequenceOf(Routine.Call(emptyList()) { s, _ -> s.append("1") }),
empty = Routine.Empty { fail("Empty is called despite construct requiring no args") }
)) },
Description(listOf(Unit))
) { _, (s) ->
if (s.length >= 2) {
seenRepeated = true
BaseFeedback(Unit, Control.STOP)
} else BaseFeedback(Unit, Control.CONTINUE)
}
}
Assertions.assertTrue(seenRepeated) { "Unmodified empty string wasn't generated" }
}
}
Expected behavior
Test passes.
Actual behavior
Test fails.
Visual proofs (screenshots, logs, images)
Timed out waiting for 1000 ms
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 1000 ms
(Coroutine boundary)
at org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:352)
at org.utbot.fuzzing.FuzzerSmokeTest$fuzzer can generate value without two repeated mutations$1$1.invokeSuspend(FuzzerSmokeTest.kt:291)
at org.utbot.fuzzing.FuzzerSmokeTest$fuzzer can generate value without two repeated mutations$1.invokeSuspend(FuzzerSmokeTest.kt:290)
Caused by: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 1000 ms
at app//kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:184)
at app//kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:154)
at app//kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:508)
at app//kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at app//kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:108)
at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
Metadata
Metadata
Assignees
Type
Projects
Status
Todo