cucumber-junit

setUp and tearDown for Scenrio outline (cucumber-jvm)

大兔子大兔子 提交于 2019-12-10 11:36:29
问题 i'm using scenario outline in my code and wanted to execute some code before the start of scenario outline and some code after the scenario outline execution has completed. I know there are @Before and @After annotations in cucumber but these gets executed before and after every scneario. So if I have a scenario outline and 3 rows of example data then @Before and @After will be executed each of then i.e. total 3 times each. But I want to execute it only once, @Before scenario outline and

How to get scenario name from a scenario outline in cucumber using java

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 10:08:33
问题 Suppose I have a test case like - *Scenario: Facebook login test GIVEN I am a Facebook user WHEN I enter my user name & password THEN login should be successful* How could I get the scenario name from the step definition methods corresponding to "I am a Facebook user" or "I enter my user name & password" or "login should be successful" ? Step definitions methods are - @Given("^I am a Facebook user$") public void method1() { //some coding //I want to get the scenario name here } @When("^I

Cucumber feature files are not executed using Maven

安稳与你 提交于 2019-12-08 12:17:43
问题 Hi I have setUp a Java project using Maven in eclipse. I am facing an issue whenever I am trying to run the script. Its is executed by the not opening the desired website which I am parsing from the feature file. Please have a look to the following code and Image of my directories setup in eclipse Here is my code for PageStepsDefs.java package com.workshop.airport.workshop.airport; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import cucumber.api.java

Cucumber @Before hook runs twice @After once

[亡魂溺海] 提交于 2019-12-08 02:34:29
问题 to all. Curently writing a little BDD Test automation framework, using Java11+Junit5+Cucumber+Selenium, build tool: Graddle. Created a little test for validating Google title. When starting test, using Test task in Graddle or running CucumberRunner class, in both cases getting the same result: two times @Before method is executed, once @After method is executed and one browser windows is staying open. After added one more test, the same situation, only 4 browsers are opened, 2 of them are

Maven/Junit Parallel Execution - Cucumber-JVM v4.0.0

痴心易碎 提交于 2019-12-07 18:48:25
问题 I'm struggling to get the new parallel execution feature of Cucumber-JVM v4.0.0 working with JUnit/Maven. As specified here, if you configure <parallel> and <threadCount> accordingly in your POM, and use dependency injection to share state (I'm using Pico Continer) then your Cucumber features should execute in parallel. However, it is still only executing one feature at a time when i run Maven. I've included my complete POM below - Can anybody help? <project xmlns="http://maven.apache.org/POM

run cucumber tests parallel using cucumber-jvm 4

末鹿安然 提交于 2019-12-07 17:10:55
问题 Java v8.x - spring v5.x cucumber v4.2.0 i tried temyers/cucumber-jvm-parallel-plugin and it works fine, but when i get to their gitihub page they announced to stop using this plugin b/c cucumber already have start supporting parallel test running support from cucumber-jvm 4.0.0. I have existing tests with using following maven dependencies. cucumber-java v4.2.0 cucumber-junit v4.2.0 cucumber-spring v4.2.0 i have two questions making me confuse. In order to use cucumber-jvm do i have to change

Unable to run Cucumber tests from maven

狂风中的少年 提交于 2019-12-07 16:31:08
问题 My Maven Project Structure is The project runs well If I try to run it through eclipse as JUnitTest (CucumberRunnerTest.java). But if I try executing it through maven then I get the below error: The pom is as below: <project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ericsson</groupId> <artifactId

Cucumber Java with Spring Boot Integration - Spring @Autowired throws NullPointer Exception

喜你入骨 提交于 2019-12-07 11:20:35
问题 I am writing cucumber-java unit tests for a Spring boot application testing each functionalities. When i integrated with spring boot, the @Autowired classes throws NullPointer Exception. The spring boot application class , @SpringBootApplication public class SpringBootCucumberTest { public static void main(String[] args) { SpringApplication.run(SpringBootCucumberTest.class, args); } } The class to be tested , @Component public class Library { private final List<BookVo> store = new ArrayList

Maven/Junit Parallel Execution - Cucumber-JVM v4.0.0

筅森魡賤 提交于 2019-12-06 05:23:59
I'm struggling to get the new parallel execution feature of Cucumber-JVM v4.0.0 working with JUnit/Maven. As specified here , if you configure <parallel> and <threadCount> accordingly in your POM, and use dependency injection to share state (I'm using Pico Continer) then your Cucumber features should execute in parallel. However, it is still only executing one feature at a time when i run Maven. I've included my complete POM below - Can anybody help? <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache

How do I run my cucumber-jvm features in parallel? (with maven using cucumber-jvm-parallel-plugin)

浪尽此生 提交于 2019-12-05 03:35:29
问题 I am trying to incorporate a maven plugin cucumber-jvm-parallel-plugin into my Cucumber-JVM code and am running into some problems... I think I have configured my pom.xml properly, but my cucumber features are still getting ran one by one instead of in parallel . How do I configure my pom.xml to make my cucumber features run in parallel? I have some feature files that block execution and I don't want to have to wait for them to finish in order to start testing the other features. I followed