Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: [Test] Expected and actual fields are interchanged in the generated tests. #42219

Closed
anupama-pathirage opened this issue Feb 23, 2024 · 1 comment · Fixed by #42228
Closed
Assignees
Labels
Area/TestFramework Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Milestone

Comments

@anupama-pathirage
Copy link
Contributor

Description

Create a new project and add a new module.

Then in the tests folder of the newly created module there is auto-generated test file. It has added expected and actual in the wrong order.

Existing:

test:assertEquals("Hello, John", welcomeMsg);
test:assertEquals("Hello, World!", welcomeMsg);

Expected:

test:assertEquals(welcomeMsg, "Hello, John");
test:assertEquals(welcomeMsg, "Hello, World!");

The generated test file is

import ballerina/io;
import ballerina/test;

// Before Suite Function

@test:BeforeSuite
function beforeSuiteFunc() {
    io:println("I'm the before suite function!");
}

// Test function

@test:Config {}
function testFunction() {
    string name = "John";
    string welcomeMsg = hello(name);
    test:assertEquals("Hello, John", welcomeMsg);
}

// Negative Test function

@test:Config {}
function negativeTestFunction() {
    string name = "";
    string welcomeMsg = hello(name);
    test:assertEquals("Hello, World!", welcomeMsg);
}

// After Suite Function

@test:AfterSuite
function afterSuiteFunc() {
    io:println("I'm the after suite function!");
}

Steps to Reproduce

bal new testproject
cd testproject
bal add module1

Affected Version(s)

Ballerina 2201.8.4 (Swan Lake Update 8)
Language specification 2023R1
Update Tool 1.4.2

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@Dilhasha Dilhasha added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Feb 26, 2024
@azinneera azinneera added this to the 2201.9.0 milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/TestFramework Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants