Saturday, January 20, 2018

Data Driven Testing using Scenario Outline in Cucumber

We have seen on way of Data Driven Testing in Data Driven Testing without Scenario Outline. Another way to perform Data Driven Testing in Cucumber is using 'Scenario Outline'. "Scenario Outline" is a keyword, if a test needs to be executed for more than one test data set it will be marked as "Scenario Outline" instead of "Scenario".

The only difference between 'Scenario' and 'Scenario Outline' is, 'Scenario Outline' comes along with a keyword called 'Example' using which the test data sets are represented in data table format.

Consider the same scenario which we been using in our tutorial, now let us automated the same test with different test data sets.

Step 1: Write the scenario using 'Scenario Outline' keyword as below

Observe that, Scenario Outline is having a red underline. Place the cursor on it, compiler telling us that 'Examples' keyword is missing. Remember that 'Scenario Outline' should always be associated with Example keyword.

Step 2: Press 'Alt+Enter' and select 'Create Example Section'.

You should see 'Examples' keyword being added after the steps as below

Step 3: Now let us modify the steps. Write down the parameter names in the <> symbol in the steps. And use same names as column names in the Examples table as shown below

Step 4:  Write the step definitions for the modified steps as we seen in the previous posts.

Here the arguments are not added automatically we need to write them manually. Also the parameter names should be converted as regular expression. Please check below screenshot

Step 5: If the step definitions are written properly, the Scenario Outline could look like below. The parameters appear in purple color.

Step 6: Now add the different test data sets in the table as below

In the above screenshot, I am running the our scenario for two test data sets Google and Facebook in Firefox and Chrome browsers.

Step 7: Run the tests and checkout the results

Both Scenario and Scenario Outline are executed. And Scenario Outline is executed for two data sets.

That is all about achieving data driven using Scenario Outline. Please comment your queries ans suggestions on this pots. Thanks for reading!!

#qababu #HappyLearning #HappyTesting


  1. Thanks for sharing valuable information and it is useful for onlineitguru provides the best selenium Online Training

    1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai

  2. Really very informative and creative contents. This concept is a good way to enhance the knowledge of Autocad.thanks for sharing please keep it up
    Software Testing Training in Gurgaon

  3. I really enjoy the blog.Much thanks again. Really Great selenium Online course

  4. I am Just Learning All the topics of Selenium Grid Through this blog.Very Thankful for this blog and also my respect to the author of blog.

  5. Hi,
    i am working with protractor with cucumber so i want to execute one scenario with multiple test data. i created feature file with one scenario outline and examples.
    i provided 4 different test data in example. when i execute my test case my test is passed with 4 test scenarios but i am able to only 3 test cases on ui page not all 4
    but test is passed.
    i am not getting what is my problem.

  6. Wondering how? In the first place, by being the creator of the problem – the volume, the velocity and the variety of data. Data Analytics Courses

  7. Build sophisticated applications leveraging the security of Amazon Web Services Cloud with the aid of our Amazon Web Services Certification Training Program. The course preps you for the AWS Solution Architect Associate certification exam. Master AWS Cloud Architecture, AWS EC2 services, AWS S3 services, AWS RDS and network service requirements and much more in this course.

  8. Hey, thanks for this great article I really like this post and I love your blog and also Check marking analytics manager in hyderabad at 360DIGITMG.
    360Digitmg marketing analytics manager in hyderabad

  9. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!

    data science course

  10. It's very useful blog post with inforamtive and insightful content and i had good experience with this information. We, at the CRS info solutions , help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes. salesforce training in Chennai who are offering good certificaiton assistance. I would say salesforce training is a best way to get certified on crm.

  11. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.

    Simple Linear Regression

    Correlation vs Covariance

  12. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

    Simple Linear Regression

    Correlation vs Covariance

  13. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.

    Simple Linear Regression

    Correlation vs Covariance

  14. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.

    Simple Linear Regression

    Correlation vs covariance

    KNN Algorithm

    Logistic Regression explained


Selenium4: Working with two parallel windows in Selenium Automation

A new method newWindow() is introduced in Selenium 4 (Alpha). Using this method we can open a new tab or new window from the current window...