{"id":1213,"date":"2012-01-08T01:15:54","date_gmt":"2012-01-07T23:15:54","guid":{"rendered":"http:\/\/blog.railsware.com\/?p=1213"},"modified":"2021-08-12T13:34:55","modified_gmt":"2021-08-12T10:34:55","slug":"capybara-with-givenwhenthen-steps-in-acceptance-testing","status":"publish","type":"post","link":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/","title":{"rendered":"Capybara with Given\/When\/Then steps in acceptance testing"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Capybara with Given\/When\/Then steps in acceptance testing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many of us use <a href=\"http:\/\/cukes.info\/\">cucumber<\/a> to write acceptance tests.<br>We must to say it&#8217;s very nice tool that allows you to write features in English plain text.<br>The main goal is provide interface that should be clear for Customer(non-programmer) and Developer.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cucumber example:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Feature: User signup\n  As a user\n  I want to sign in\n  So I can use service features\n\n  Background:\n    Given user with \"jack@daniles.com\" email and \"qwerty\" password\n\n  Scenario: Signing in with correct credentials\n    When I go to sign in page\n    And I fill in \"email\" with \"jack@daniles.com\"\n    And I fill in \"password\" with \"qwerty\"\n    And I click \"Login\" button\n    Then I should see \"Welcome, jack@daniles.com!\"\n\n  Scenario: User tries to sign in with incorrect password\n    When I go to sign in page\n    And I fill in \"email\" with \"jack@daniles.com\"\n    And I fill in \"password\" with \"bla\"\n    And I click \"Login\" button\n    Then I should see \"Invalid credentials\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s very readable. But cucumber has one big downside:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Steps maintenance<\/pre>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">All steps are global and a instance variable from one step is accessible in another step.<br>In big project it can easy lead to mess.<br>Also you can read some rants about cucumber:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/www.software-testing.com.au\/blog\/2010\/08\/31\/does-cucumber-suck\/\">Does cucumber suck?<\/a><\/li><li><a href=\"http:\/\/blog.codegram.com\/2011\/5\/why-cucumber-sucks-and-i-still-love-it\">Why Cucumber sucks and I still love it<\/a><\/li><li><a href=\"https:\/\/gist.github.com\/770894\">Why Steak (over Cucumber)<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Previously we also use cucumber as tool for user stories.<br>Lately we found that our customers <strong>NEVER<\/strong> read cucumber features.<br>So do we need it anymore? Let&#8217;s check alternatives.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you probably know, cucumber use internally <a href=\"https:\/\/github.com\/jnicklas\/capybara\">Capybara<\/a> for steps implementation. And there is even more &#8211; latest version of Capybara comes with a built in DSL for creating descriptive acceptance tests!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So we decided to switch to pure rspec+capybara testing.<br>We moved our features to <em>spec\/acceptance<\/em> directory.<br>Let&#8217;s look at rspec+capybara example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RSpec+Capybara example<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cat spec\/acceptance\/signup_feature_spec.rb<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">feature \"User signup\" do\n  background do\n    @user = Factory(:user, :email =&gt; 'jack@daniles.com', :password =&gt; 'qwerty')\n  end\n\n  scenario \"Signing in with correct credentials\" do\n    page.visit \"\/sessions\/new\"\n    page.fill_in \"email\", :with =&gt; \"jack@daniles.com\"\n    page.fill_in \"password\", :with =&gt; \"qwerty\"\n    page.click_button \"Login\"\n    page.should have_content(\"Welcome, jack@daniles.com!\")\n  end\n\n  scenario \"User tries to sign in with incorrect password\" do\n    page.visit \"\/sessions\/new\"\n    page.fill_in \"email\", :with =&gt; \"jack@daniles.com\"\n    page.fill_in \"password\", :with =&gt; \"bla\"\n    page.click_button \"Login\"\n    page.should have_content(\"Invalid credentials\")\n  end\nend<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thus approach has one big benefit:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Feature description and feature implementation are located together.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You don&#8217;t need anymore to jump between feature and step files to guess where is implementation for a step.<br>It&#8217;s nice but there are also two downsides.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First downsides is that RSpec documentation output will be too poor and it&#8217;s not enough informative:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ rspec -fs -c spec\/acceptance\/signup_feature_spec.rb\n\nUser signup\n  Signing in with correct credentials\n  User tries to sign in with incorrect password\n\nFinished in 13.55 seconds\n2 examples, 0 failures<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Second downside is that scenario does not have anymore exact boundary blocks or steps.<br>It makes harder to understand the scenario flow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Real user story often has big scenarios and we realized that cucumber steps were cool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There were two ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>switch back to cucumber<\/li><li>go further and invent<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/railsware.com\/railswarians\/\">Railswarians<\/a> never go back :)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Our Solution<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you decided to switch from Cucumber to Capybara acceptance testing try <a href=\"https:\/\/github.com\/railsware\/rspec-example_steps\">rspec-example steps<\/a> gem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With this gem you may use <em>Given\/When\/Then<\/em> steps into rspec example!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RSpec+Capybara+Steps example<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">feature \"User signup\" do\n  background do\n    @user = Factory(:user, :email =&gt; 'jack@daniles.com', :password =&gt; 'qwerty')\n  end\n\n  Steps \"Signing in with correct credentials\" do\n    When \"I go to sign in page\" do\n      page.visit \"\/sessions\/new\"\n    end\n    And \"I fill in right email\" do\n      page.fill_in \"email\", :with =&gt; @user.email\n    end\n    And \"I fill in  right password\" do\n      page.fill_in \"password\", :with =&gt; \"qwerty\"\n    end\n    And \"I click login\" do\n      page.click_button \"Login\"\n    end\n    Then \"I should see greeting\" do\n      page.should have_content(\"Welcome, #{@user.email}!\")\n    end\n  end\n\n  Steps \"User tries to sign in with incorrect password\" do\n    When \"I go to sign in page\" do\n      page.visit \"\/sessions\/new\"\n    end\n    And \"I fill in right email\" do\n      page.fill_in \"email\", :with =&gt; @user.email\n    end\n    And \"I fill in wrong password\" do\n      page.fill_in \"password\", :with =&gt; \"bla\"\n    end\n    And \"I click login\" do\n      page.click_button \"Login\"\n    end\n    Then \"I should see error\" do\n      page.should have_content(\"Invalid credentials\")\n    end\n  end\nend<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And documentation output will be:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ rspec -fs -c spec\/acceptance\/signup_feature_spec.rb<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">User signup\n  Signing in with correct credentials\n    When I go to sign in page\n    And I fill in right email\n    And I fill in right password\n    And I click login\" do\n    Then I should see greeting\n  User tries to sign in with incorrect password\n    When I go to sign in page\n    And I fill in right email\n    And I fill in wrong password\n    And I click login\n    Then I should see error\n\nFinished in 13.55 seconds\n2 examples, 0 failures<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now it&#8217;s much better. Isn&#8217;t it? :)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RSpec Example Steps features<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Does not hack RSpec Example. It only extends it.<\/li><li>Brings Given\/When\/Then\/And\/But steps support into rspec example block that allow you to better organize scenario<\/li><li>Adds shared_steps DSL<\/li><li>Adds ability to mark step as pending<\/li><li>Reports with color about passed\/pending\/failed step into documentation formating output<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">$ gem install rspec-example_steps<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Usage<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">See <a href=\"https:\/\/github.com\/railsware\/rspec-example_steps\/blob\/master\/README.md\">README<\/a> for more details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just add to <em>spec\/spec_helper.rb<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">require 'rspec\/example_steps'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And enjoy Given\/When\/Then step usage!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">References<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/railsware\/rspec-example_steps\">rspec-example_steps<\/a><\/li><li><a href=\"https:\/\/github.com\/cucumber\/cucumber\">cucumber<\/a><\/li><li><a href=\"https:\/\/github.com\/LRDesign\/rspec-steps\">rspec-steps<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it&#8217;s very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I&#8230;<\/p>\n","protected":false},"author":19,"featured_media":9498,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[3],"tags":[],"coauthors":["Andriy Yanko"],"class_list":["post-1213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it&#039;s very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"Andriy Yanko\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"| Blog on Engineering, Product Management, Transparency, Culture and many more...\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Capybara with Given\/When\/Then steps in acceptance testing | Railsware Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it&#039;s very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t\t<meta property=\"og:image:height\" content=\"360\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-01-07T23:15:54+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2021-08-12T10:34:55+00:00\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#article\",\"name\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing | Railsware Blog\",\"headline\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing\",\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/ayanko\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/Capybara-with-Given.png\",\"width\":360,\"height\":360,\"caption\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing\"},\"datePublished\":\"2012-01-08T01:15:54+03:00\",\"dateModified\":\"2021-08-12T13:34:55+03:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#webpage\"},\"articleSection\":\"Engineering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"position\":2,\"name\":\"Engineering\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#listItem\",\"name\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#listItem\",\"position\":3,\"name\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Logo-circle.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#organizationLogo\",\"width\":3137,\"height\":1054,\"caption\":\"Railsware logo\"},\"image\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/ayanko\\\/#author\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/ayanko\\\/\",\"name\":\"Andriy Yanko\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#authorImage\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/andriy-yanko-96x96.jpg\",\"width\":96,\"height\":96,\"caption\":\"Andriy Yanko\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#webpage\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/\",\"name\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing | Railsware Blog\",\"description\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it's very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/ayanko\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/ayanko\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/01\\\/Capybara-with-Given.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#mainImage\",\"width\":360,\"height\":360,\"caption\":\"Capybara with Given\\\/When\\\/Then steps in acceptance testing\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/capybara-with-givenwhenthen-steps-in-acceptance-testing\\\/#mainImage\"},\"datePublished\":\"2012-01-08T01:15:54+03:00\",\"dateModified\":\"2021-08-12T13:34:55+03:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Capybara with Given\/When\/Then steps in acceptance testing | Railsware Blog","description":"Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it's very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I","canonical_url":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#article","name":"Capybara with Given\/When\/Then steps in acceptance testing | Railsware Blog","headline":"Capybara with Given\/When\/Then steps in acceptance testing","author":{"@id":"https:\/\/railsware.com\/blog\/author\/ayanko\/#author"},"publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png","width":360,"height":360,"caption":"Capybara with Given\/When\/Then steps in acceptance testing"},"datePublished":"2012-01-08T01:15:54+03:00","dateModified":"2021-08-12T13:34:55+03:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#webpage"},"isPartOf":{"@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#webpage"},"articleSection":"Engineering"},{"@type":"BreadcrumbList","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/railsware.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","position":2,"name":"Engineering","item":"https:\/\/railsware.com\/blog\/category\/development\/","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#listItem","name":"Capybara with Given\/When\/Then steps in acceptance testing"},"previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#listItem","position":3,"name":"Capybara with Given\/When\/Then steps in acceptance testing","previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}}]},{"@type":"Organization","@id":"https:\/\/railsware.com\/blog\/#organization","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","url":"https:\/\/railsware.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2020\/11\/Logo-circle.png","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#organizationLogo","width":3137,"height":1054,"caption":"Railsware logo"},"image":{"@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/railsware.com\/blog\/author\/ayanko\/#author","url":"https:\/\/railsware.com\/blog\/author\/ayanko\/","name":"Andriy Yanko","image":{"@type":"ImageObject","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#authorImage","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2021\/06\/andriy-yanko-96x96.jpg","width":96,"height":96,"caption":"Andriy Yanko"}},{"@type":"WebPage","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#webpage","url":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/","name":"Capybara with Given\/When\/Then steps in acceptance testing | Railsware Blog","description":"Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it's very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/railsware.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#breadcrumblist"},"author":{"@id":"https:\/\/railsware.com\/blog\/author\/ayanko\/#author"},"creator":{"@id":"https:\/\/railsware.com\/blog\/author\/ayanko\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png","@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#mainImage","width":360,"height":360,"caption":"Capybara with Given\/When\/Then steps in acceptance testing"},"primaryImageOfPage":{"@id":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/#mainImage"},"datePublished":"2012-01-08T01:15:54+03:00","dateModified":"2021-08-12T13:34:55+03:00"},{"@type":"WebSite","@id":"https:\/\/railsware.com\/blog\/#website","url":"https:\/\/railsware.com\/blog\/","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","inLanguage":"en-US","publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"| Blog on Engineering, Product Management, Transparency, Culture and many more...","og:type":"article","og:title":"Capybara with Given\/When\/Then steps in acceptance testing | Railsware Blog","og:description":"Capybara with Given\/When\/Then steps in acceptance testing. Many of us use cucumber to write acceptance tests.We must to say it's very nice tool that allows you to write features in English plain text.The main goal is provide interface that should be clear for Customer(non-programmer) and Developer. Cucumber example: Feature: User signup As a user I","og:url":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/","og:image":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png","og:image:secure_url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png","og:image:width":360,"og:image:height":360,"article:published_time":"2012-01-07T23:15:54+00:00","article:modified_time":"2021-08-12T10:34:55+00:00"},"aioseo_meta_data":{"post_id":"1213","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-6385f5b01616f","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":{"locations":{"business":{"name":"","businessType":"","image":"","areaServed":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"streetLine1":"","streetLine2":"","zipCode":"","city":"","state":"","country":"","addressFormat":"#streetLineOne\n#streetLineTwo\n#city, #state #zipCode"},"contact":{"email":"","phone":"","phoneFormatted":"","fax":"","faxFormatted":""},"ids":{"vat":"","tax":"","chamberOfCommerce":""},"payment":{"priceRange":"","currenciesAccepted":"","methods":""}}},"openingHours":{"useDefaults":true,"show":true,"alwaysOpen":false,"use24hFormat":false,"timezone":"","labels":{"closed":"","alwaysOpen":""},"days":{"monday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"tuesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"wednesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"thursday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"friday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"saturday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"sunday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"}}}},"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-01-04 12:44:08","updated":"2025-09-26 11:13:39","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\/category\/development\/\" title=\"Engineering\">Engineering<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCapybara with Given\/When\/Then steps in acceptance testing\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/railsware.com\/blog"},{"label":"Engineering","link":"https:\/\/railsware.com\/blog\/category\/development\/"},{"label":"Capybara with Given\/When\/Then steps in acceptance testing","link":"https:\/\/railsware.com\/blog\/capybara-with-givenwhenthen-steps-in-acceptance-testing\/"}],"categories_data":[{"name":"Engineering","link":"https:\/\/railsware.com\/blog?category=development"}],"post_thumbnails":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2012\/01\/Capybara-with-Given.png","article_background":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/1213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/comments?post=1213"}],"version-history":[{"count":20,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/1213\/revisions"}],"predecessor-version":[{"id":13970,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/1213\/revisions\/13970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media\/9498"}],"wp:attachment":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media?parent=1213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/categories?post=1213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/tags?post=1213"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/coauthors?post=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}