Skip to main content

Posts

Showing posts with the label table

Using Examples Table in Cucumber

Using Examples in Cucumber is a great thing for testing world! Examples is a keyword and you can define a set of variable to repeat your case with the whole set of data in the examples block.  We can re-write the examples which checks the login page of amazon.com with Examples feature of Cucumber. Check the following code: In the  amazon_login.feature file we are reading <username> , <password> and <message> variables from the Examples. This means that the scenario which has the steps used these variables will run 2 times, which is the number of row in the examples. There should some changing in the Capybara, Ruby file.  "(.*?)" this means the function takes a string parameter but we are sending table variable so we need to change  (.*) for string variable in table and  (\d+) for integer variable in table.     As you can see from the result there are  3 scenarios ( 3 passed) and 9 steps ( 9 passed) . This means that " Scen