-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-contest-estimatorIssue is related to contest estimatorIssue is related to contest estimatorctg-bugIssue is a bugIssue is a buglang-javaIssue is related to Java supportIssue is related to Java supportpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev team
Milestone
Description
Description
Tests on timeout for JUnit4 are generated without method under test call.
To Reproduce
- Install one of the latest IU plugin built from main in IntelliJ Idea 2022.2 Ultimate - take
utbot-intellij-IU-2023.3.*artefact - Create a project and add the following class:
public class A {
public int hangForSeconds(int seconds) {
for (int i = 1; i < seconds; i++) {
try {
Thread.sleep(1001);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
return seconds;
}
}- Generate tests for it
with JUnit4 / TestNG testing framework selected
with default settings (Fuzzing/Symbolic) and Mock everything outside package andMock static methods - Check the generated tests
Expected behavior
Generated test on timeouts should contain call of the method under test.
Actual behavior
JUnit4 test on timeout has comment /* This execution may take longer than the 1000 ms timeout and therefore fail due to exceeding the timeout. */
But there is no method call.
Visual proofs (screenshots, logs, images)
Tests generated with JUnit4 framework:
@Test(timeout = 1000L)
public void testHangForSeconds_ThreadSleep() {
A a = new A();
/* This execution may take longer than the 1000 ms timeout
and therefore fail due to exceeding the timeout. */
}Tests generated with TestNG framework:
@Test(description = "hangForSeconds: return seconds -> TimeoutExceeded", timeOut = 1000L)
public void testHangForSeconds_ThreadSleep() {
A a = new A();
/* This execution may take longer than the 1000 ms timeout
and therefore fail due to exceeding the timeout. */
}Environment
Seems to be environment independent issue.
Used: Windows 10 Pro, Gradle, JDK 8-17
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-contest-estimatorIssue is related to contest estimatorIssue is related to contest estimatorctg-bugIssue is a bugIssue is a buglang-javaIssue is related to Java supportIssue is related to Java supportpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev team
Type
Projects
Status
Done