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

Dataprovider parameters are not displayed in test result when using Factory annotation #2117

Closed
AwareTo opened this issue Jul 23, 2019 · 5 comments

Comments

@AwareTo
Copy link

AwareTo commented Jul 23, 2019

TestNG Version 6.14.3

Expected behavior

TestNG results will show the parameters used. Without the parameters it is hard to distinguish which test case failed.

Actual behavior

Test Results do not display the the test parameters when using Factory annotation
testng-results.xml Shows no parameters
This issue is similar to another issue which is status is closed: #1041

Test case sample

public class Test3 {
    protected  List<String> data;

    @Factory (dataProvider = "getDataForInstances")
    public Test3(List<String> dataToSet) {
    	this.data = dataToSet;
    }

  @Test
    public void Sanity(){
      String text = this.data.get(this.data.size()-1);
       System.out.println("Printing Parameters when running test method [" + text + "]");
       }


@DataProvider(name = "getDataForInstances")
public static Object[][] getDataForInstances( ITestNGMethod method) {
    System.out.println("Method name = " + method.getConstructorOrMethod().getName() + "()\n");

    return new Object[][] {
      {Collections.singletonList("Java")},
      {Arrays.asList("TestNG", "JUnit")},
      {Arrays.asList("Maven", "Gradle", "Ant")}
      };
    }

}

Thanks

@krmahadevan
Copy link
Member

@AwareTo - This issue was fixed only in later versions. The latest released version of TestNG is 7.0.0-beta7. Please try using that and comment if this is still a problem.

@AwareTo
Copy link
Author

AwareTo commented Jul 24, 2019

@krmahadevan Indeed using latest beta test-ng-results.xml do present the parameters. However, I noticed that Eclipse do not show the parameters at the results window.
Eclipse do show the dataprovider parameters if Factory annotation is not used.
I noticed that the test-ng-results.xml has a different format when using Factory annotation. is this causing the Eclipse results issue?
Thank you for your help!

@krmahadevan
Copy link
Member

@AwareTo - For eclipse, you might want to log an issue in https://github.com/cbeust/testng-eclipse/issues

The TestNG eclipse plugin has a beta version that will be taking care of the new changes.

I noticed that the test-ng-results.xml has a different format when using Factory annotation.

Can you show the difference between the latest beta version and 6.14.3 ?

@AwareTo
Copy link
Author

AwareTo commented Jul 24, 2019

@krmahadevan I opened the following issue: testng-team/testng-eclipse#437
So I guess this issue(2117) can be closed.

Can you show the difference between the latest beta version and 6.14.3 ?

I meant there is a difference at the xml tags of testng-results.xml xml when using Factory+Dataprovider annotations vs using the Dataprovider annotation only. Both using version 7.0.0-beta7
I guess this is by design and not an issue. Sorry if I was not clear.
Thanks a lot for your help. It helped me to complete a framework I was working-on.

@krmahadevan
Copy link
Member

Based on above comments, I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants