cucumber-junit

How do I set the path to my Cucumber features using cucumber-junit?

烈酒焚心 提交于 2019-12-29 04:14:49
问题 I try to build my first executable specifications with Java and Maven. I created a simple project with this structure: specification |-src |-test |-java |-mypackage |-MyFeatureTest.java |-resources |-MyFeature.feature In the junit test MyFeatureTest.java I have this: import org.junit.runner.RunWith; import cucumber.junit.Cucumber; @RunWith(Cucumber.class) public class HomepageTest { } Now https://github.com/cucumber/cucumber-jvm/wiki/IDE-support says that I should add the following line:

how to create executable jar file with cucumber tests?

走远了吗. 提交于 2019-12-25 16:12:14
问题 My service create an executable jar by gradle. When i create and run my jar (java -jar file.jar) i recive error: no main manifest attribute, in "file.jar" because i don't have main_class. I created main method: public static void main(final String[] args) throws Throwable { String[] arguments = {"--plugin", "html:build/reports/cucumber", "src/test/resources/features", "--glue", "src/test/java/steps"}; cucumber.api.cli.Main.main(arguments); } and My program founds the features but doesn't

how to create executable jar file with cucumber tests?

好久不见. 提交于 2019-12-25 16:09:56
问题 My service create an executable jar by gradle. When i create and run my jar (java -jar file.jar) i recive error: no main manifest attribute, in "file.jar" because i don't have main_class. I created main method: public static void main(final String[] args) throws Throwable { String[] arguments = {"--plugin", "html:build/reports/cucumber", "src/test/resources/features", "--glue", "src/test/java/steps"}; cucumber.api.cli.Main.main(arguments); } and My program founds the features but doesn't

Cucumber `--tags` options from command line?

我是研究僧i 提交于 2019-12-23 11:46:10
问题 What i would like to do is to pass cucumber options from command line to execute scenarios with tag name @extecuteThese but also i wanted to exclude scenarios that are with tag name @WIP so what am i doing so far is -Dcucumber.options='--tags @executeThese --tags ~@WIP' But unfortunately, it's not considering ~@WIP tag option Any help, much appreciated!! 回答1: Lets pretend this is your feature: Feature ABC @executeThese Scenario: abc1 @WIP @executeThese Scenario: abc2 What you are currently

cucumber.runtime.CucumberException: Failed to instantiate class

最后都变了- 提交于 2019-12-23 04:57:07
问题 Here is my cucumber base class. @CucumberOptions(plugin = "json:target/cucumber-report.json", features="SFDC_Automation/features/featurefilename.feature", glue="classpath:tests.SFDC.StepDef") public class InsideSaleTest extends AbstractTestNGCucumberTests { } And after running this base class, I am seeing following exception. cucumber.runtime.CucumberException: Failed to instantiate class tests.SFDC.InsideSale.InsideSaleEndToEnd ===============================================

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

java.lang.NoClassDefFoundError exception while running cucumber test using JUnit

六眼飞鱼酱① 提交于 2019-12-17 20:07:36
问题 I'm trying to run a cucumber test with JUnit and I'm getting java.lang.NoClassDefFoundError exception. JUnit code: package ctest; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( features = "Feature" ,glue={"stepDefinition"} ) public class Runner { } Exception: java.lang.NoClassDefFoundError: gherkin/formatter/Formatter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang

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