Closed
Description
Description
UTBot could find situations which leads to arithmetic overflow and generate tests for such cases adding comment that such test would fail, but actually such test pass.
To Reproduce
Steps to reproduce the behavior:
- Open
utbot
project in IntelliJ Idea - In UTBot settings set
Overflow detection:
toTreat overflows as errors
- Set
Test generated method
to 100 %Symbolic
- Generate tests for
org.utbot.examples.math.OverflowExamples#intOverflow
method - Open the generated test
Expected behavior
Either UTBot generates test which causes ArithmeticException during execution
Or it doesn't write that test should fail
Actual behavior
Test which are supposed to generate errors are generated, but during execution they pass.
Sample of such test:
@Test
@DisplayName("intOverflow: x * x * x > 0 -> ThrowArithmeticException")
public void testIntOverflow_ThrowArithmeticException() {
OverflowExamples overflowExamples = new OverflowExamples();
/* This test fails because method [org.utbot.examples.math.OverflowExamples.intOverflow] produces [java.lang.ArithmeticException: int * overflow] */
overflowExamples.intOverflow(-11086, 0);
}
Visual proofs (screenshots, logs, images)
Additional context
So this case is more about how to properly present results of UTBot finding. Currently there are at least two problems:
- incorrect comment that test fails
- as test pass it would be difficult to find such test in case of bulk test generation, so overflow problem could be left unnoticed.
Probably we should addfail()
to such test, so it would actually fail and draw user attention.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done