TestNG DataProviders and asserts
I read the article that you wrote: http://toolsqa.com/selenium-webdriver/testng-parameters-data-provider/
In a scenario where I want to automate the login functionality of a website , I want to provide 2 data sets:
- invalid username and invalid password
- valid username and valid password
I want my first test case to provide invalid credentials with the first set of data that I defined in the DataProvider method. Than I want to execute the first assert, and verify that I get the error message: ERROR: The password you entered for the email address firstname.lastname@example.org is incorrect.
In the second test case I want to provide valid credentials with the second set of data that I defined in the DataProvider method. Than I want to execute the second assert, and verify that I’m logged in.
Since the test method runs twice and both assert statements are running, one test always passes and one test always fails.
How do I use assert in this scenario?