diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml index 1e8a27afa5..b3966c1b6a 100644 --- a/testing-modules/rest-testing/pom.xml +++ b/testing-modules/rest-testing/pom.xml @@ -65,13 +65,13 @@ - info.cukes + io.cucumber cucumber-java ${cucumber.version} test - info.cukes + io.cucumber cucumber-junit ${cucumber.version} @@ -105,56 +105,44 @@ true - - - - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - - classes - 4 - - - - - integration-test - verify - - - - - - com.github.temyers - cucumber-jvm-parallel-plugin - 5.0.0 - - - generateRunners - generate-test-sources - - generateRunners - - - - com.baeldung.rest.cucumber - - src/test/resources/Feature/ - SCENARIO - - - - - - + + + parallel + + + + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + CucumberIntegrationTest.java + + methods + 2 + + + + + integration-test + verify + + + + + + + + + 19.0 2.9.0 - 1.2.5 + 6.8.0 2.21.0 0.6.1 diff --git a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature b/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature deleted file mode 100644 index 99dd8249fe..0000000000 --- a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature +++ /dev/null @@ -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 \ No newline at end of file diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java index f80178a43d..33e2c62301 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java @@ -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") diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java index 35a913ae25..f1fcb48f01 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java @@ -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() { } diff --git a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature index 99dd8249fe..f8bbd809de 100644 --- a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature +++ b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature @@ -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 \ No newline at end of file