3

whenever we use dataprovider in our tests , the test data which is being used will also gets print on the console, how can we disable this functionality ? Can anyone pls help me on this ?

eg:

    @Test(dataProvider = "data-provider", dataProviderClass = DataProviderClass.class)
    public void testMethod(String data) 
    {
        System.out.println("Data is: " + data);
    }
     @DataProvider(name = "data-provider")
    public static Object[][] dataProviderMethod() 
    {
        return new Object[][] { { "data one" }, { "data two" } };
    }

o/p:Data is: data one

Data is: data two

PASSED: testMethod(“data one”)

PASSED: testMethod(“data two”)

here the testdata which is being used is also getting printed ,how can we disable this functionality?

htshame
  • 6,599
  • 5
  • 36
  • 56

1 Answers1

0

A data provider has no functionality of printing anything. Its your print statement inside the Test method that is printing the data. If you don't want to print anything to the console, remove the

 System.out.println("Data is: " + data);

from the test method definition. I'm pretty sure your issue is something else as the problem statement is quite obvious. Feel free to update the question.