cucumber

Is there a “for each” or equivalent syntax for Gherkin/Cucumber?

萝らか妹 提交于 2019-12-10 20:49:35
问题 Is there any equivalent "for each" statement for Gherkin? In the following scenario, the page I am testing has multiple date fields that I'd like to run the same test examples on. Here is the scenario that I would like to model. Scenario Outline: Modify precision values for date controls Given I have just added a record When I select <precision> And I select <value> Then <date> displays in the <date type> field Examples: | date type | precision | value | date | | Date 1 | Unknown | N/A |

How do I close() and quit() Selenium driver without affecting other steps in Cucumber and Selenium?

拥有回忆 提交于 2019-12-10 19:54:09
问题 I have two feature files in Cucumber that are linked to corresponding step files. The problem is that when one of the step file finishes execution then it closes all the browser windows (because of driver.quit() ) whereby killing the execution of other step file which hasn't done processing yet. Here each step file opens a new browser window, executes the tests within it and then closes and quits the browser. Currently I have just two step files but in the future there are going to be many

Port of the Rails app when running Cucumber tests

妖精的绣舞 提交于 2019-12-10 18:35:44
问题 Is there a way to get, in the test, the port in which the rails app is running during cucumber test? I tried Capybara.server_port but that's nil. Thanks. 回答1: When using the selenium driver, the port can be found on: Capybara.current_session.driver.rack_server.port and when using the webkit driver, it can be found on: Capybara.current_session.driver.server_port Alternative, you can set Capybara.server_port to a known value and use that. 回答2: My understanding is that if you're using rack-test,

Testing EventMachine with cucumber

家住魔仙堡 提交于 2019-12-10 18:17:27
问题 I'm trying to write a cucumber feature and rspec tests for my application for accessing the twitter streaming api with twitter-stream. I've got the following code: Then /^I should see the latest (\d+) tweets from my timeline$/ do |num| timeline = Starling::Timeline::Mine.new(@store) EventMachine::run { tweets = timeline.latest timeline.stop } tweets.length.should == num.to_i end the code for the method is: def latest token = @token.get_token @stream = Twitter::JSONStream.connect(options)

Gradle doesn't pick up Cucumber-jvm

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:12:32
问题 I am trying to run Cucumber-jvm from Gradle. However no matter what I do I cannot get the features to actually run. They are always skipped while other JUnit tests are run. My features are in src/test/resources and I have a JUnit test in src/test/java with @RunWith(Cucumber.class) and @Feature(Myfeature.feature) attributes specified. Here is my Gradle script: repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.+' testCompile group: 'info.cukes

Pico container exception: org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException:?

强颜欢笑 提交于 2019-12-10 18:06:39
问题 I seem to be getting a pico container exception: org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException. My code is as follows: Page Object representing a specific page of a website: public class GooglePage { private WebDriver driver; private String stringLocator = "edffsfds"; @FindBy(how = How.XPATH,using = "//div[@id='header']/ul[1]/li[11]/a") public WebElement logout; public GooglePage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this)

When to switch from cucumber to rspec in the BDD cycle for a login procedure

丶灬走出姿态 提交于 2019-12-10 17:47:53
问题 I'm still trying to understand the combination of cucumber and rspec in the BDD cycle. I have defined the following scenarios for a very simple login system: Feature: Log in In order to get access to the application As a user I want to log in Scenario: User logs in successfully Given I exist as a user When I go to the login page And I fill in "username" with "gabrielhilal" And I fill in "password" with "secret" And I press "Login" Then I should see "Welcome gabrielhilal" And I should be

Feature and scenario outline name in cucumber before hook

谁说我不能喝 提交于 2019-12-10 17:38:43
问题 If I have a simple cucumber feature and scenario , like this (example code is from cucumber wiki): Feature: Eating cucumbers Scenario: eat 5 out of 12 Given there are 12 cucumbers When I eat 5 cucumbers Then I should have 7 cucumbers I know how to get feature and scenario name in before hook: Before do |scenario| p [scenario.feature.name, scenario.name] end The above code returns: ["Eating cucumbers", "eat 5 out of 12"] The problem is if the feature has scenario outline : Scenario Outline:

Cant run feature in Cucumber

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:25:55
问题 Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial. It is not defined and is as follows: Feature: Proof that my concept works Scenario: My first test Given this is my first step When this is my second step Then this is my final step My Cucumber runner class is as follows: package cucumber; import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @Cucumber.Options( format = {"pretty", "json:target/"}, features

selenium.click() doesn't work: Argument 1 of EventTarget.dispatchEvent does not implement interface Event

旧街凉风 提交于 2019-12-10 16:29:36
问题 I have the next problem: I try to run a simple click with DefaultSelenium object just like this: private DefaultSelenium seleniumClient = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8080"); @When("^I try to login with user \"([^\"]*)\" and password \"([^\"]*)\"$") public void I_try_to_login_with_user_and_password(String userName, String password) throws Throwable { enterData("id=username", userName); enterData("id=password",password); seleniumClient.click("id=login");