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
When using Seed.Recursive with modification X that has a parameter of type T, while there are no seeds for type T, fuzzer doesn't generate any values for that Seed.Recursive (except for the ones produced by its Routine.Empty, which is typically just null)
Real world (concrete) example
No integration tests using topicRepository.save(Topic) modification are generated for methods of TopicService class in Medical-Web-App project (or any other class that depends on TopicRepository). That happens because:
Fuzzing platform fails to generate non-null values for Topic type due to point 2 and 3 (concern of this issue).
Modification topicRepository.save(Topic) is only used with null values of topic, which causes modification itself to fail before we even get to method under test.
To Reproduce
Run the following unit test.
fun`fuzzer can generate non empty values even when it can't modify it due to lack of seeds`() {
classType(valhasSeeds:Boolean)
classValue(valisEmpty:Boolean)
runBlocking {
withTimeout(1000) {
runFuzzing(
{ _, type ->if (type.hasSeeds) sequenceOf(Seed.Recursive(
construct =Routine.Create(emptyList()) { Value(isEmpty =false) },
modify = sequenceOf(Routine.Call(listOf(Type(hasSeeds =false))) { _, _ ->
fail("Value is generated for type with no seeds")
}),
empty =Routine.Empty { Value(isEmpty =true) }
))
else emptySequence()
},
Description(listOf(Type(hasSeeds =true)))
) { _, (value) ->if (value.isEmpty) BaseFeedback(result =Unit, Control.CONTINUE)
elseBaseFeedback(result =Unit, Control.STOP)
}
}
}
}
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.FuzzerSmokeTest$fuzzer can generate non empty values even when it can't modify it due to lack of seeds$1.invokeSuspend(FuzzerSmokeTest.kt:445)
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 [email protected]/java.lang.Thread.run(Thread.java:1589)
The text was updated successfully, but these errors were encountered:
Description (abstract example)
When using
Seed.Recursive
with modificationX
that has a parameter of typeT
, while there are no seeds for typeT
, fuzzer doesn't generate any values for thatSeed.Recursive
(except for the ones produced by itsRoutine.Empty
, which is typically justnull
)Real world (concrete) example
No integration tests using
topicRepository.save(Topic)
modification are generated for methods ofTopicService
class inMedical-Web-App
project (or any other class that depends onTopicRepository
). That happens because:Topic.setCreationTime(LocalDateTime)
modification.LocalDateTime
(a separate issue Java fuzzer can't create any values for types with no public constructor (e.g.LocalDateTime
) #2437).null
values forTopic
type due to point 2 and 3 (concern of this issue).topicRepository.save(Topic)
is only used withnull
values oftopic
, which causes modification itself to fail before we even get to method under test.To Reproduce
Run the following unit test.
Expected behavior
Test passes.
Actual behavior
Test fails.
Visual proofs (screenshots, logs, images)
The text was updated successfully, but these errors were encountered: