Cucumber DataDriven

In previous post we have seen about cucumber introduction with selenium, now in this post we see how can we write simple feature file with datadriven.

1. Create the feature file to login to AnukoTimesheet (that has some data in the feature file)
2. Create Step definition class file (here we should use Datatable API to read the data)
3. Runner class
4. Run the script

Note : I assume that you have gone through the basic cucumber and installation post earlier.



Step 1 : To create the feature file as LoginTestDataTable .feature under src/test/resources




Step4 : Run the cukes file now 

if you are getting error like this, better download latest version of selenium jar and add the class path manually as show in below snapshot. 
      Caused by: java.lang.ClassNotFoundException: com.google.common.base.Optional



To run script follow the below snapshot



5. Report - go to project and target folder to view the reports.




and then report should look like this.




That's it we have seen simple data driven with datatable api.

Thanks


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.