Title: Fuzzer can't generate values (even without any modifications) when there are some modifications it fails to use · Issue #2428 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Fuzzer can't generate values (even without any modifications) when there are some modifications it fails to use · Issue #2428 · UnitTestBot/UTBotJava
X Title: Fuzzer can't generate values (even without any modifications) when there are some modifications it fails to use · Issue #2428 · UnitTestBot/UTBotJava
Description: Description (abstract example) 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...
Open Graph Description: Description (abstract example) 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.Re...
X Description: Description (abstract example) 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 See...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/2428
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fuzzer can't generate values (even without any modifications) when there are some modifications it fails to use","articleBody":"**Description (abstract example)**\r\n\r\nWhen 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`)\r\n\r\n**Real world (concrete) example**\r\n\r\nNo integration tests using `topicRepository.save(Topic)` modification are generated for methods of [`TopicService` class in `Medical-Web-App` project](https://github.com/MathAndMedLab/Medical-Web-App/blob/63ed67c73466eacea25e1a6335091e0e261fd535/src/main/java/com/app/medicalwebapp/services/TopicService.java) (or any other class that depends on `TopicRepository`). That happens because:\r\n1. There's `Topic.setCreationTime(LocalDateTime)` modification.\r\n2. Java fuzzer can't generate any values for `LocalDateTime` (_a separate issue_ #2437).\r\n3. Fuzzing platform fails to generate non-`null` values for `Topic` type due to point 2 and 3 (**concern of this issue**).\r\n4. 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.\r\n\r\n**To Reproduce**\r\n\r\nRun the following unit test.\r\n```kotlin\r\nfun `fuzzer can generate non empty values even when it can't modify it due to lack of seeds`() {\r\n class Type(val hasSeeds: Boolean)\r\n class Value(val isEmpty: Boolean)\r\n\r\n runBlocking {\r\n withTimeout(1000) {\r\n runFuzzing(\r\n { _, type -\u003e\r\n if (type.hasSeeds) sequenceOf(Seed.Recursive(\r\n construct = Routine.Create(emptyList()) { Value(isEmpty = false) },\r\n modify = sequenceOf(Routine.Call(listOf(Type(hasSeeds = false))) { _, _ -\u003e\r\n fail(\"Value is generated for type with no seeds\")\r\n }),\r\n empty = Routine.Empty { Value(isEmpty = true) }\r\n ))\r\n else emptySequence()\r\n },\r\n Description(listOf(Type(hasSeeds = true)))\r\n ) { _, (value) -\u003e\r\n if (value.isEmpty) BaseFeedback(result = Unit, Control.CONTINUE)\r\n else BaseFeedback(result = Unit, Control.STOP)\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTest passes.\r\n\r\n**Actual behavior**\r\n\r\nTest fails.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\n```\r\nTimed out waiting for 1000 ms\r\nkotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 1000 ms\r\n (Coroutine boundary)\r\n 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)\r\nCaused by: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 1000 ms\r\n at app//kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:184)\r\n at app//kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:154)\r\n at app//kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:508)\r\n at app//kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)\r\n at app//kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:108)\r\n at java.base@19.0.2/java.lang.Thread.run(Thread.java:1589)\r\n```","author":{"url":"https://github.com/IlyaMuravjov","@type":"Person","name":"IlyaMuravjov"},"datePublished":"2023-07-20T10:56:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2428/UTBotJava/issues/2428"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3c016caf-9b60-8e5b-8298-426681f55c37 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E32A:27724A:36DEE:47D75:698DD68C |
| html-safe-nonce | 99b0fa2b7b5b48c468e8816c951352c550ab45b150a6ad1b6a86dd6a598566d9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzJBOjI3NzI0QTozNkRFRTo0N0Q3NTo2OThERDY4QyIsInZpc2l0b3JfaWQiOiI0NTEzNjQ1OTgyODQ4NTA1NDg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 32a95e3b9d100176e83f43761971d5b4f159da740c5104ad34015742e454c13b |
| hovercard-subject-tag | issue:1813712382 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/UnitTestBot/UTBotJava/2428/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4743250ee86c78c538960bb5fe8d5a20d42eb44274923639bc000aeffaef6961/UnitTestBot/UTBotJava/issues/2428 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4743250ee86c78c538960bb5fe8d5a20d42eb44274923639bc000aeffaef6961/UnitTestBot/UTBotJava/issues/2428 |
| og:image:alt | Description (abstract example) 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.Re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IlyaMuravjov |
| hostname | github.com |
| expected-hostname | github.com |
| None | d9c5a945db9d79f5476dbe75d3700f24739ef28ab02037163bdeac4050cd4ded |
| turbo-cache-control | no-preview |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1e3d09effb9f6299d5990409f03a0dfa8eca8595 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width