Data driven approach- Module 20 | Selenium Forum
M
Posted on 26/02/2016
Hi Ashish,

I tried to create data driven approach with maven and testNG( Explained in module 20) using Xls_reader file. I need to read test data from Xlsx file, I have set of 20 test data in different rows for one test case but for that one test case I will have one assertion for validating all 20 scenarios which are including positive and negative scenarios. How to handle negative scenarios against one assertion.

For example :- I have test case for User Registration in application.And I have 20 scenarios to test like validating valid email user, invalid email user(-Ve scenario), invalid password(-ve scenario), All these scenarios will have different rows in xl and I am reading data successfully in my test case. But in my test case I have added one assertion - if URL of application changes to /enroll means test case passed and user registration successfully completed, if not then test case failed. But for my -ve scenarios like invalid email, invalid password, submit button itself will not enable and test case will fail.

My question is how to handle all scenarios(+ve and -ve) mentioned in Xl sheet against one assertion(for +ve scenario) in my test case?

Please suggest.

M
Replied on 27/02/2016

Keep a col with exp result in sheet
Mention the err message in that and then use selenium to read err from app
Compare that err to value in that col


M
Replied on 28/02/2016

Thanks for response.

In my Application, I need to register new user and I have to supply data in couple of fields like first name ,last name, email, password etc. and the click on submit button. I have added all validation scenarios in Xl sheet along with Expected result col.

Now, the behavior of app is if any invalid data is provided like incorrect email,null email,invalid password(all -ve scenarios) submit button will be disabled where as in other cases with + ve scenarios submit button will enable and I can proceed with registering new user process.

How to handle it?


M
Replied on 03/03/2016

you have to make another column for expected result.