cucumber

Handling excel spreadsheets with Cucumber Scenario Outline

爱⌒轻易说出口 提交于 2019-12-09 19:38:18
问题 I am trying to see, if possible, to have a more elegant way to handle calling nTh numbers from a Cucumber Scenario Outline that correlates to an excel spreadsheet row(nth). Currently I am using iteration numbers to define the row # of the excel spread sheet to pull the data from. I wanted to see if it was possible to use cucumber with excel in a more elegant way than the below example with the scenario outline. Some background: Each iteration needs to be its own scenario. Hence why I'm not

Can you define instance variables during Cucumber's Given, When, and Then step definitions

偶尔善良 提交于 2019-12-09 18:35:56
问题 I know with Cucumber, you can define instance variables during a Given step definition. This instance variable becomes part of the World scope. Then you can access this instance variable during step definitions of When and Then. Can you define instance variables also during When and Then step definitions and access them in the later When and Then step definitions? If it's possible, is it even a common practice to define instance variables during When and Then step definitions? Thank you. 回答1:

Guardfile for running single cucumber feature in subdirectory?

强颜欢笑 提交于 2019-12-09 18:13:20
问题 I have my features organized in subfolders, like this: app/ features/ users/ feature1.feature feature2.feature But everytime I save a feature, Guard runs all my features (not just the one that was edited). How can I change it to only run the one that was saved? Here's my Guardfile for Cucumber: guard 'cucumber', :cli => "--drb --require features/support --require features/step_definitions" do watch(%r{features/.+\.feature}) watch(%r{features/support/.+}) { 'features' } watch(%r{features/step

sql error cannot start a transaction within a transaction while testing with cucumber

[亡魂溺海] 提交于 2019-12-09 17:16:23
问题 I'm new to cucumber and I'm learning BDD When I'm trying to fill a form and create a record this sqlite error is shown, though there's no error when I tried the code manually in my browser. I'm using rails 4. here is my controller code class Admin::ItemsController < ApplicationController def index @items=Item.all end def new @item=Item.new end def create @item=Item.new items_params respond_to do |format| if @item.save format.html { redirect_to admin_items_path } else format.html { redirect_to

@javascript cucumber tests pass using selenium driver but fail when using poltergiest

十年热恋 提交于 2019-12-09 16:50:17
问题 I'm trying to test an jquery UI autocomplete, I've got the tests passing using the selenium driver. I want to switch to poltergiest for some headless testing, but now my tests are now failing. It doesn't seem to select the autocomplete option for some reason that I have yet been able to figure out Step When /^select contract$/ do VCR.use_cassette("contract") do selector = '.ui-menu-item a:contains("John Smith (123456)")' within("div#review") do fill_in("contract", with: "john") end sleep 2

Using pry-rescue to debug exceptions in Cucumber steps

喜你入骨 提交于 2019-12-09 16:43:36
问题 I've added an Around hook to my Cucumber features that I had hoped would cause pry-rescue to start pry when an exception was thrown: Around do |scenario, block| Pry::rescue do block.call end end The Around hook is definitely being called, however exceptions thrown within steps aren't rescued. E.g. this step: When(/^I perform the action$/) do raise 'hell' end ... causes the feature to fail, but doesn't drop me into pry at the console. Is it possible to use pry-rescue with Cucumber? I've raised

How to switch between different version of gem installed?

落花浮王杯 提交于 2019-12-09 14:33:03
问题 I have three version of rack installed on local machine ( rack (1.4.1, 1.3.6, 1.3.5) ). For some gem (such as Cucumber ), it requires a lower version of rack to be activated? I have tried with bundle but there is no good. When executed, cucumber will still use the activated rack with version 1.4.1 of the system. Bundle specifies which gem should be installed but doesn't ensure which gem will be activated . How could I activate certain version of rack ? 回答1: You can specify a version in

How do I compare xml output in a Cucumber step using a multiline string example?

流过昼夜 提交于 2019-12-09 13:39:48
问题 Chargify has this Cucumber scenario in their docs. Scenario: Retrieve a customer via my reference id (as an integer or simple string) Given I have a customer with these attributes | reference | first_name | last_name | email | | 7890 | Joe | Blow | joe@example.com | When I send a GET request to https://[@subdomain].chargify.com/customers/lookup.xml?reference=7890 Then the response status should be "200 OK" And the response should be the xml: """ <?xml version="1.0" encoding="UTF-8"?>

How do I create a Cucumber DataTable?

旧时模样 提交于 2019-12-09 10:10:08
问题 I want to manually set up a Cucumber DataTable using Java (instead of Gherkin). In Gherkin, my table would look like this: | h1 | h2 | | v1 | v2 | My Java so far looks like this: List<String> raw = Arrays.asList( "v1", "v2"); DataTable dataTable = DataTable.create(raw, Locale.getDefault(), "h1", "h2"); What I get back is a DataTable with headers but no contents. It's also longer than expected: | h1| h2 | | | | | | | I'm sure the solution must be fairly simple, but I'm a bit at a loss right

How do I test error conditions in HTML5 pages with cucumber?

こ雲淡風輕ζ 提交于 2019-12-09 08:08:56
问题 I am testing web application behavior with Cucumber (using Selenium and Watir under the hood). My web app has HTML5 pages and makes use of the new "required" attribute. If I have a data entry form with a required field, and I submit that form with the field blank, I would like to verify that the web app correctly responds with an error condition. Unfortunately, when testing using an HTML5 web browser, the error message that pops up on a failed field validation does not appear to be accessible