UTBotJava icon indicating copy to clipboard operation
UTBotJava copied to clipboard

Missing input parameters in DisplayName annotation for successful tests

Open alisevych opened this issue 3 years ago • 0 comments

Description

There are missing input parameters in DisplayName annotation for the generated tests.

To Reproduce

  1. Run the 'utbot' project in IntelliJ Idea 2022.3.3 Ultimate
  2. Install plugin built from main
  3. Use plugin to generate tests for Recursion$factorial
  4. Open the generated test

Expected behavior

DisplayName is supposed to contain input parameters - or conditions for this test method.

Actual behavior

There are only method name - and returned value. Input parameters or conditions are missing. There are two tests with inputs n=0 and n=1 - but DisplayName for them are equal:

    @DisplayName("factorial: -> return 1")

Visual proofs (screenshots, logs, images)

    ///region SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method factorial(int)

    /**
     * @utbot.classUnderTest {@link Recursion}
     * @utbot.methodUnderTest {@link Recursion#factorial(int)}
     * @utbot.executesCondition {@code (n == 0): False}
     * @utbot.invokes {@link Recursion#factorial(int)}
     * @utbot.triggersRecursion factorial, where the test return from: {@code return 1;}
     * @utbot.returnsFrom {@code return n * factorial(n - 1);}
     */
    @Test
    @DisplayName("factorial: -> return 1")
    public void testFactorial_NNotEqualsZero() {
        Recursion recursion = new Recursion();

        int actual = recursion.factorial(1);

        assertEquals(1, actual);
    }

    /**
     * @utbot.classUnderTest {@link Recursion}
     * @utbot.methodUnderTest {@link Recursion#factorial(int)}
     * @utbot.returnsFrom {@code return 1;}
     */
    @Test
    @DisplayName("factorial: -> return 1")
    public void testFactorial_Return1() {
        Recursion recursion = new Recursion();

        int actual = recursion.factorial(0);

        assertEquals(1, actual);
    }
    ///endregion

Environment

Windows 10 Pro IntelliJ IDEA Ultimate 2022.3.3 Gradle, JDK 17

Additional context

In the test that asserts IllegalArgumentException thrown the following DisplayName is generated:

    @DisplayName("factorial: n < 0 -> ThrowIllegalArgumentException")

alisevych avatar Apr 07 '23 11:04 alisevych