BAEL-4659: Upgrade Cucumber to 6.8.0 (#10115)

This commit is contained in:
kwoyke 2020-10-02 19:28:05 +02:00 committed by GitHub
parent 67e2165bb6
commit be48134840
5 changed files with 41 additions and 62 deletions

View File

@ -65,13 +65,13 @@
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
@ -105,56 +105,44 @@
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<parallel>classes</parallel>
<threadCount>4</threadCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<glue>
<package>com.baeldung.rest.cucumber</package>
</glue>
<featuresDirectory>src/test/resources/Feature/</featuresDirectory>
<parallelScheme>SCENARIO</parallelScheme>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>parallel</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<includes>
<include>CucumberIntegrationTest.java</include>
</includes>
<parallel>methods</parallel>
<threadCount>2</threadCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<!-- util -->
<guava.version>19.0</guava.version>
<!-- testing -->
<rest-assured.version>2.9.0</rest-assured.version>
<cucumber.version>1.2.5</cucumber.version>
<cucumber.version>6.8.0</cucumber.version>
<wiremock.version>2.21.0</wiremock.version>
<karate.version>0.6.1</karate.version>

View File

@ -1,10 +0,0 @@
Feature: Testing a REST API
Users should be able to submit GET and POST requests to a web service, represented by WireMock
Scenario: Data Upload to a web service
When users upload data on a project
Then the server should handle it and return a success status
Scenario: Data retrieval from a web service
When users want to get information on the Cucumber project
Then the requested data is returned

View File

@ -1,8 +1,8 @@
package com.baeldung.rest.cucumber;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "classpath:Feature")

View File

@ -20,6 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@ -29,8 +31,6 @@ import org.apache.http.impl.client.HttpClients;
import com.github.tomakehurst.wiremock.WireMockServer;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class StepDefinition {
@ -66,7 +66,8 @@ public class StepDefinition {
wireMockServer.stop();
}
@When("^users want to get information on the (.+) project$")
// @When("^users want to get information on the '(.+)' project$")
@When("users want to get information on the {string} project")
public void usersGetInformationOnAProject(String projectName) throws IOException {
wireMockServer.start();
@ -86,11 +87,11 @@ public class StepDefinition {
wireMockServer.stop();
}
@Then("^the server should handle it and return a success status$")
@Then("the server should handle it and return a success status")
public void theServerShouldReturnASuccessStatus() {
}
@Then("^the requested data is returned$")
@Then("the requested data is returned")
public void theRequestedDataIsReturned() {
}

View File

@ -6,5 +6,5 @@ Feature: Testing a REST API
Then the server should handle it and return a success status
Scenario: Data retrieval from a web service
When users want to get information on the Cucumber project
When users want to get information on the 'Cucumber' project
Then the requested data is returned