{"id":13510,"date":"2017-02-23T00:00:00","date_gmt":"2017-02-23T06:00:00","guid":{"rendered":"https:\/\/centricconsulting.com\/post\/understanding-cucumber-scenarios_sqat\/"},"modified":"2022-01-03T15:22:54","modified_gmt":"2022-01-03T20:22:54","slug":"understanding-cucumber-scenarios_sqat","status":"publish","type":"post","link":"https:\/\/centricconsulting.com\/blog\/understanding-cucumber-scenarios_sqat\/","title":{"rendered":"Understanding Cucumber Scenarios"},"content":{"rendered":"

Learn about Scenarios\u00a0in part three of our\u00a0How-To-Guide on applying Cucumber\u00a0to lead your agile testing team\u00a0down the path to\u00a0automation.<\/h2>\n

Blog three of a series<\/a>.<\/em><\/p>\n

In the previous blog Understanding Cucumber Features<\/a><\/strong>, we learned where our BDD Acceptance Criteria test scripts need to be placed in the Cucumber automation framework.<\/p>\n

But you can\u2019t just copy and paste the script(s) into the .feature file and run them. You need to tell Cucumber that they are scripts. You can accomplish this by using one of three keywords: Scenario, Scenario Outline, or Background.<\/p>\n

Scenario Outlines and Backgrounds will be covered in future blogs. Here, we will discuss Scenarios.<\/p>\n

Cucumber Scenarios in Agile Testing Words<\/h2>\n

The Cucumber Book<\/a> describes each Scenario as \u201c\u2026a single concrete example of how the system should behave in a particular situation. If you add together the behavior defined by all of the scenarios, that\u2019s the expected behavior of the feature itself.\u201d<\/p>\n

In agile testing words, each Scenario is a test case. As defined by Software Testing Fundamentals<\/a>\u00a0define a test case as \u201c..a set of conditions or variables under which a tester will determine whether a system under test satisfies requirements or works correctly.\u201d<\/p>\n

The Acceptance Criteria test scripts are your initial \u201chappy path\u201d scripts. These are the scripts where everything goes right: the correct set-up (Given block), the correct actions (When block) lead to the correct expected results (Then block).<\/p>\n

To let Cucumber know a script is a Scenario you need to use the keyword Scenario. The format is:<\/p>\n

\"Agile<\/p>\n

For the title, you want to make sure it is descriptive enough so you, and future testers, know what is being tested in the Scenario. But try to keep it concise.<\/p>\n

A little utilized fact about Scenarios: like the .feature file they are part of, each Scenario has some white space where you can put text. Any lines after the title line, but before the first script line, is white space.<\/p>\n

This is a good spot to call out any details or script specific notes not readily apparent in the script. If you wish to include some description, the Scenario format becomes:<\/p>\n

\"Agile<\/p>\n

We have created a title line, added some notes and are now ready to add our Acceptance Criteria test script. As the formats above show, the scripts go after the title line.<\/p>\n

\"Agile<\/a><\/p>\n

Scenarios, or Test Cases as they are commonly referred to, are what drives the Cucumber test automation framework. With a fully-written Scenario in place, you are now ready to begin automating.<\/p>\n","protected":false},"excerpt":{"rendered":"

In blog three of a series, we explore agile test cases. Or, as they are known in the Cucumber framework: Scenarios.<\/p>\n","protected":false},"author":63,"featured_media":25997,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","footnotes":""},"categories":[1],"tags":[],"coauthors":[15012],"acf":[],"publishpress_future_action":{"enabled":false,"date":"2024-07-21 22:41:26","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"category"},"_links":{"self":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts\/13510"}],"collection":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/comments?post=13510"}],"version-history":[{"count":0,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts\/13510\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/media\/25997"}],"wp:attachment":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/media?parent=13510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/categories?post=13510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/tags?post=13510"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/coauthors?post=13510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}