Open
Description
Description
Hanging tests duplicates are not minimized.
There are two identical tests: one generated by Fuzzing, one by Symbolic engine (when default or some custom mode is used).
To Reproduce
- Open/create a project in IntelliJ Idea
- Install one of the latest plugins built from main
- In Settings -> Tools -> UnitTestBot set Fuzzing + Symbolic generation mode
- Check Hanging test timeout (1000 ms by default)
- Generate tests for the following code:
public void sleep() throws InterruptedException {
Thread.sleep(5000);
}
Expected behavior
One test on timeout should be present in the resulting test class.
Actual behavior
There are two identical tests in the test class.
Visual proofs (screenshots, logs, images)
///region SYMBOLIC EXECUTION: TIMEOUTS for method sleep()
/**
* @utbot.classUnderTest {@link TimeoutTest}
* @utbot.methodUnderTest {@link TimeoutTest#sleep()}
* @utbot.invokes {@link Thread#sleep(long)}
*/
@Test
@DisplayName("sleep: -> TimeoutExceeded")
@org.junit.jupiter.api.Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
public void testSleep_ThreadSleep() throws InterruptedException {
TimeoutTest timeoutTest = new TimeoutTest();
/* This execution may take longer than the 1000 ms timeout
and therefore fail due to exceeding the timeout. */
assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> timeoutTest.sleep());
}
///endregion
///region FUZZER: TIMEOUTS for method sleep()
/**
* @utbot.classUnderTest {@link TimeoutTest}
* @utbot.methodUnderTest {@link TimeoutTest#sleep()}
*/
@Test
@DisplayName("sleep: ")
@org.junit.jupiter.api.Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
public void testSleep() throws InterruptedException {
TimeoutTest timeoutTest = new TimeoutTest();
/* This execution may take longer than the 1000 ms timeout
and therefore fail due to exceeding the timeout. */
assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> timeoutTest.sleep());
}
///endregion
Environment
IntelliJ IDEA 2022.3 / 2023.1
Metadata
Metadata
Assignees
Type
Projects
Status
Todo