cucumber-jvm

Cucumber-jvm Hooks when Scenario is passed or failed

霸气de小男生 提交于 2020-01-24 04:19:06
问题 In Jbehave we can execute method upon outcome of scenario success/failure. One of the below mentioned methods will execute after failure and success. @AfterScenario(uponOutcome=AfterScenario.Outcome.SUCCESS) public void afterSuccessfulScenario() { // Some code to execute... } @AfterScenario(uponOutcome=AfterScenario.Outcome.FAILURE) public void afterFailedScenario() { // Some code to execute... } I'm trying to achieve the same thing in Cucumber-jvm . The scenario Hooks @Before and @After will

How to run mvn cucumber test using jar file?

烂漫一生 提交于 2020-01-16 19:42:26
问题 I have created a test automation framework using maven and cucumber. 1) I want to create a jar file which includes everything (all project files) 2) Then I want to run a test from the command line using above created jar like using the command ( mvn clean test -Dcucumber.options='--tags @all' ) I don't want to use the main method or anything. 回答1: java -Dcucumber.options="--tags @all" -jar your-test-jar.jar Try this. Although I am not sure why you don't want to use the main method. If you don

Is it possible to pass Java-Enum as argument from cucumber feature file (in a more text friendly way)?

邮差的信 提交于 2020-01-15 15:29:26
问题 Building up on this question, the example provided seems to lock the text in the feature file too much to Java programming style (notice that the text is written in all uppercase, and is only one word. Is it possible to pass enums when the feature file has more "human readable" text? E.g.: Simple Example Feature: Setup Enum and Print value In order to manage my Enum As a System Admin I want to get the Enum Scenario Outline: Verify Enum Print When I supply a more human readable text to be

Is it possible to pass Java-Enum as argument from cucumber feature file (in a more text friendly way)?

两盒软妹~` 提交于 2020-01-15 15:27:26
问题 Building up on this question, the example provided seems to lock the text in the feature file too much to Java programming style (notice that the text is written in all uppercase, and is only one word. Is it possible to pass enums when the feature file has more "human readable" text? E.g.: Simple Example Feature: Setup Enum and Print value In order to manage my Enum As a System Admin I want to get the Enum Scenario Outline: Verify Enum Print When I supply a more human readable text to be

Cucumber picocontainer/SharedDriver doesn't handle browser instance properly

回眸只為那壹抹淺笑 提交于 2020-01-15 10:41:30
问题 I'm using cucumber-jvm picocontainer to share selenium driver between classes. I have ShareDriver and WebDriverFactory class. My problem is the following: 1. If I run 2 test cases, the driver/browser instance is closed after the first test case, new browser instance is created and run the second one. I would like to use only 1 browser instance and run the tests, then close it. IEDriverServer.exe and one java.exe are stucked on task manager after the test, however the browser is closed. I need

Testing Electron application with org.openqa.selenium in a Java environment (Intellij)

眉间皱痕 提交于 2020-01-13 04:56:25
问题 Is there a way to create automated scenarios using cucumber and selenium-webdriver in Java environment for an Electron application? I found some Node.js solutions on electron.atom.io, but I would prefer Java. Thanks. 回答1: You can use Electron browser with ChromeDriver. Try creating WebDriver with similar setup: // If chromediver executable is not in your project directory, // point to it with this system variable System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe"); Map

Execute only specific examples in a Scenario Outline

旧时模样 提交于 2020-01-11 06:36:05
问题 We're looking to better manage test data using Cucumber in our Java test automation framework. For a Scenario Outline , we're looking to tabulate test parameters categorized by the applicable environment in which they will run. For example, Scenario Outline: Login into application Given I am on the homepage in the <environment> When I enter my <user> And I enter my <pass> Then I am taken to the homepage Examples: |user |pass |environment| |test |test1 |local | |retest |retest1 |sit |

[Cucumber][JVM][Maven]Tests dosen't run from command line through maven

☆樱花仙子☆ 提交于 2020-01-07 03:00:18
问题 I am running tests using java, cucumber with Maven. I am using Eclipse IDE. Also the pom.xml has cucumber dependencies. I am running tests in two ways. From Eclipse IDE: I run tests as Junit tests and the test results are successful. 2: From command promt: My test failed and below is the result. Here is the Pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 <groupId>CCIRA_Test_Auto</groupId> <artifactId>CCIRA_Test_Auto</artifactId> <version>0.0.1</version> <packaging>jar</packaging>

How to suppress Cucumber/Junit assertion stack trace

让人想犯罪 __ 提交于 2020-01-05 02:11:06
问题 I have a cucumber scenario and the step uses assertEquals . My results report shows the stack trace which is not end user friendly. How can I suppress it Scenario: Add two numbers Given I have two inputs "3" and "2" When I add them Then the output should be "15" 回答1: You're correct in observing that the default XML output (assuming you're not outputting to JSON or text, but you didn't say) from a Junit tests show stack traces for failed steps. This isn't actually a Cucumber thing.

NoSuchMethodError after run JUnit test with Cucumber

天大地大妈咪最大 提交于 2020-01-04 14:12:23
问题 I'm using Intellij IDEA IDE. I wrote 2 java classes and 1 feature cucumber file in project. feature structure is: Feature: First test with Cucumber Scenario: Testing Given file.xml from ext When take project path Then run test Also I wrote 1 jUnit java class for RunTest with Cucumber.class: import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; import org.hamcrest.SelfDescribing; import gherkin.util.FixJava; import cucumber.deps.com.thoughtworks.xstream.converters