Skip to content

Fuzzer violates UtMock assumptions #1524

@mmvpm

Description

@mmvpm

Description

Fuzzer generates test with x == 0 for the code:

import org.utbot.api.mock.UtMock;

public class Main {
    int foo(int x) {
        UtMock.assume(x != 0);
        return 1 / x;
    }
}

But it violates UtMock.assume semantics.

To Reproduce

  1. Set the "Test generation method" to Fuzzer 5% / Symbolic execution 95%
  2. Use plugin to generate tests for the code above
  3. Open the generated tests

Expected behavior

No tests violate UtMock assumptions.

Actual behavior

Fuzzer generates a test:

@Test
@DisplayName("foo: x = zero -> throw RuntimeException")
public void testFooThrowsUMAVEWithCornerCase() {
    Main main = new Main();

    /* This test fails because method [Main.foo] produces [java.lang.RuntimeException]
        org.utbot.api.mock.UtMock.assume(UtMock.java:19)
        Main.foo(Main.java:5) */
    main.foo(0);
}

Metadata

Metadata

Assignees

Labels

comp-fuzzingIssue is related to the fuzzingctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions