DataProvider | Selenium Forum
W
Waqar Ali Posted on 10/10/2021

In page object with cucumber

1: I have to fill up form which has some mandatory fields and some non mandatory.

2: In scenario i have data

|FName|LName|DOB|Mobile|Email|Address|Hobbies|Subjects|

3: I filled up all fields first and create data provider for this step

4: It works fine and filled up all fields and submit form at the end by clicking on submit button

 

My question is if we have to do positive scenario just only filling up Mandatory fields and leve empty non mandatory fields to check the form submit successfully or not? Is this possible with same dataprovider

 

Second if we have to do negative testing to leave one or more than one mandatory fields empty and click on submit button, will it work with same dataprovider

 

Can we use same dataprovider for testing to run it multiple times by leaving any field mandatory or non mandatory to check our scenarios?

 

Please update on this


A
Ashish Thakur Replied on 11/10/2021

Yes you can use same data provider. You will have to keep flags in data and identity.


W
Waqar Ali Replied on 13/10/2021

@Ashish will you please give example how to use flag. Or means what is flag actually didn't get the idea to use flag.

means keep it empty or put something 

 

pleaae elaborate it in but mire details if you can

 

thanks


A
Ashish Thakur Replied on 01/11/2021

You can keep expected Error column in your data and put the error in that and verify

You have to put the expected error somewhere for a data set for a test. You can keep it in row of xls file or in JSON