cucumber-jvm

Specify the feature file location in cucumber

只谈情不闲聊 提交于 2019-12-19 07:17:12
问题 I have created some cucumber test steps and a small Cucumber test case, which I run with JUnit like so: @RunWith(Cucumber.class) public class FuelCarTest { //executs cucumber steps in the class FuelCarSteps } The Cucumber features files are now automatically loaded from the classpath location, src/main/resources/<package-name>/*.feature I could like to know how I can tell cucumber the location of my feature files, because I need it to load them from a location outside the classpath (e.g. data

Take a screenshot with Cucumber

你说的曾经没有我的故事 提交于 2019-12-18 18:38:28
问题 I just learn how to use cucumber. Can you tell me how to complete this code? You can implement step definitions for undefined steps with these snippets: Then /^I take a screenshot$/ do pending # express the regexp above with the code you wish you had end 回答1: Screenshots in general are taken when something unexpected occurs. You may also want to capture a screenshot to report when a test case fails. In this particular case, you should have screenshot capture logic in an @After method that

Cucumber JVM: Test if the correct exception is thrown

心已入冬 提交于 2019-12-18 14:13:35
问题 How to test that the correct exception is thrown when using Cucumber JVM? When using JUnit, I would do something like this: @Test(expected = NullPointerException.class) public void testExceptionThrown(){ taskCreater.createTask(null); } As you can see, this is very elegant. But how can I achieve the same elegance, when using cucumber JVM? My test looks like this right now: @Then("the user gets a Null pointer exception$") public void null_exception_thrown() { boolean result = false; try {

SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()? (Selenium)

倖福魔咒の 提交于 2019-12-18 11:35:53
问题 I am trying to write some selenium automated UI tests using Cucumber/Java. If I have only one test in my feature file, everything works fine. But if I add a second test, I get this error on driver.get() : org.openqa.selenium.remote.SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()? Build info: version: '2.51.0', revision: '1af067dbcaedd7d2ab9af5151fc471d363d97193', time: '2016-02-05 11:20:57' Basically, I am initializing the webdriver variable on the

AfterAll global hook cucumber-jvm

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 08:55:44
问题 I'm using cucumber-jvm in my integration tests and I need to execute some code after all scenarios are finished, just once. After reading carefully some posts like this and reviewed this reported issue, I've accomplished it doing something like this: public class ContextSteps { private static boolean initialized = false; @cucumber.api.java.Before public void setUp() throws Exception { if (!initialized) { // Init context. Run just once before first scenario starts Runtime.getRuntime()

Cucumber scenario outline and examples with generic step definitions

a 夏天 提交于 2019-12-18 00:07:18
问题 I have a Feature file which is as below: Scenario Outline: Create ABC Given I open the application When I enter username as <username> And I enter password as <password> Then I enter title as <title> And press submit Examples: | username | password | title | | Rob | xyz1 | title1 | | Bob | xyz1 | title2 | This mandates me to have step definitions for each of these values. Can i instead have a generic step definition that can be mapped for every username or password or title values in the

Cucumber scenario outline and examples with generic step definitions

╄→гoц情女王★ 提交于 2019-12-18 00:06:07
问题 I have a Feature file which is as below: Scenario Outline: Create ABC Given I open the application When I enter username as <username> And I enter password as <password> Then I enter title as <title> And press submit Examples: | username | password | title | | Rob | xyz1 | title1 | | Bob | xyz1 | title2 | This mandates me to have step definitions for each of these values. Can i instead have a generic step definition that can be mapped for every username or password or title values in the

Rerunning failed cucumber tests using cucumber-jvm

旧城冷巷雨未停 提交于 2019-12-17 17:52:49
问题 I have a Cucumber-JVM, JUnit, Selenium setup. I initiate the run by running RunSmokeTests.java using JUnit within Eclipse. I have also set up a maven profile to run the tests from command line, and possibly Jenkins in the future. When the tests are run then some of them may fail sometimes, mainly due to the application taking longer than expected. I would then have to re-run these scenarios. At the moment I run them by manually attaching @rerun tag to the ones that failed and then running

cucumber jvm CucumberException: No features found at []

五迷三道 提交于 2019-12-14 00:20:35
问题 In my cucumber -jvm, Maven, junit Setup I have my testRunner file as package com.lebara.testrunner; import cucumber.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @Cucumber.Options( glue = {"com.lebara.stepdefs","com.lebara.framework.main", "com.lebara.testrunner"}, features = "C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources", format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target

Getting File permissions error when exploding the cucumber-jvm.jar

余生长醉 提交于 2019-12-13 17:33:19
问题 I am trying to create an executable jar for functional tests by exploding the dependency jars, using gradle task of type Jar. Cucumber-1.1.3 is one of the dependencies. I am using gradle 1.1 with JVM 1.6 (company standards) I get the following error : org.gradle.api.GradleException: Could not expand ZIP '/dev/shm/263985/transformer/caches/artifacts-14/filestore/info.cukes/cucumber-java/1.1.3/jar/4b389fbe494942b319518d27ae38571f477967f6/cucumber-java-1.1.3.jar'. at org.gradle.api.internal.file