TestNG Output

Hi,

http://www.toolsqa.com/selenium-webdriver/testng-data-provider-excel/

Final Test Case – What is the expected result for this Test Method.
I have provided 2 sets of Test data(User name & Password). But TestNg shows me
Total tests run: 1, Failures: 0, Skips: 0.

How will i get the “Total tests run: 2, Failures: 0, Skips: 0″ ?

Many Thanks,
Revathi

Add Comment
6 Answer(s)

Hi,

Can you share your code?

smitha Default Answered on May 8, 2015.

Please use comment section…

on May 9, 2015.
Add Comment

Hi Smitha,

Code is provided in the ToolsQA site only. The test method runs twice for the provided test data, since i have provided 2 sets of Username & Password. But Test NG displays Total tests run: 1, Failures: 0, Skips: 0. result.

I want to know what should we do to get Total tests run: 2, Failures: 0, Skips: 0 as a result.

Thanks,
Revathi

Revathi Train Answered on May 8, 2015.
Add Comment

To get “Total tests run: 2, Failures: 0, Skips: 0″, in your testng class you need to specify 2 @test methods. instead of giving 2 inputs in same test, try giving the 2nd input in another @test method.

smitha Default Answered on May 8, 2015.
Add Comment

I am providing test data from excel sheet as 2 columns then how do i control this scenario?

Thanks,
Revathi

Revathi Train Answered on May 8, 2015.

Please use comment section…

on May 9, 2015.
Add Comment

Hi,
I am also working on that. refer this link http://software-testing-tutorials-automation.blogspot.in/2014/07/create-workspace-and-project-for.html .you will get Idea,  Once I succeed, I ll also help you!

smitha Default Answered on May 8, 2015.
Add Comment

It should display “Total tests run: 2, Failures: 0, Skips: 0″.. Even I got the  exact result only.

Just do check the execution. Is it closing the browser window? is the test executing properly.

If you want you can simply check this


public class DataProviderTest{
private static WebDriver driver;
@DataProvider(name = "Authentication")
public static Object[][] credentials() {
// The number of times data is repeated, test will be executed the same no. of times
// Here it will execute two times
return new Object[][] { { "testuser_1", "Test@123" }, { "testuser_1", "Test@123" }};
}
// Here we are calling the Data Provider object with its Name
@Test(dataProvider = "Authentication")
public void test(String sUsername, String sPassword) {
System.out.println(sUsername+"\n "+sPassword);
}
}

RavinderReddy Train Answered on May 8, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.