Skip to content

UTBot generates test method names containing a typo #485

Closed
@onewhl

Description

@onewhl

Description

UTBot generates method names containing a typo -- si instead of is.

To Reproduce

Run tests in SummaryReturnExampleTest.kt and expect the provided test names. Or run UTBot on the code snippet below.

Actual behavior

UTBot generates test method names containing a typo (si instead of is). For example, testCompareChars_0OfCharactertoCharsiEqualsA.

Expected behavior

I expect to get the name equal testCompareChars_0OfCharactertoCharIsEqualA. This name is not perfect too, but at least it doesn't contain the typo.

Visual proofs (screenshots, logs, images)

Run UTBot on the following code snippet:

    public char compareChars(char a, char b, int n) {
        if (n < 1)
            return ' ';
        for (int i = 0; i < n; i++) {
            if (Character.toChars(i)[0] == a) {
                return b;
            }
            if (Character.toChars(i)[0] == b) {
                return a;
            }
        }
        return a;
    }

You will get methods with these names:

        "testCompareChars_NLessThan1"
        "testCompareChars_0OfCharactertoCharsiEqualsA" // si -> is
        "testCompareChars_0OfCharactertoCharsiEqualsB" // si -> is
        "testCompareChars_0OfCharactertoCharsiNotEqualsB" // si -> is

Environment

Java 11

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

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions