Skip to content

Generated tests contain JUnit4 @Test and commented JUnit5 @DisplayName annotations #576

Closed

Description

@alisevych

Description

Tests generated with JUnit4 framework selected - contain JUnit4 @test and commented JUnit5 @DisplayName annotations.

To Reproduce

Steps to reproduce the behavior:

  1. IntelliJ IDEA with UTBot plugin installed is opened
  2. Open a project with JDK 8-11
  3. Open a public class with a public method
  4. Use plugin to generate tests with JUnit4 test framework selected

Expected behavior

Only JUnit4 annotations are supposed to be used.

Actual behavior

@org.junit.jupiter.api.DisplayName are present, though commented

Visual proofs (screenshots, logs, images)

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class BinarySearchTest {
...
    @Test
    //@org.junit.jupiter.api.DisplayName("rightBinSearch: array = long[10], key = 0L -> return 10")
    public void testRightBinSearchReturns10WithNonEmptyPrimitiveArrayAndCornerCase() {
...

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.3
UTBot plugin version: https://github.com/UnitTestBot/UTBotJava/actions/runs/2717703384

Activity

  1. moved this to Todo in UTBot Javaon Jul 22, 2022
  2. added
    ctg-bugIssue is a bug
    comp-summariesSomething related to the method names, code comments and display names generation
    on Jul 22, 2022
  3. alisevych commented on Jul 29, 2022

    @alisevych
    MemberAuthor

    As discussed @onewhl @denis-fokin
    The short description of the test method should be added as:

    remove - for JUnit4 // Java doc has this information

    @DisplayName("<short description>") - for JUnit5 - with corresponding import

    @Test(description = "<short description>") - for TestNG

    related docs: TestNG annotations, JUnit5 DisplayName, JUnit4 - no analogues.

  4. Repository owner moved this from Todo to Done in UTBot Javaon Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

comp-summariesSomething related to the method names, code comments and display names generationctg-bugIssue is a bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions