From 5718949c4bf191a715358172e153b41c56f0f16f Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo Date: Tue, 17 Dec 2024 18:19:15 +0100 Subject: [PATCH] [SELC-5969] Added fake test to cucumber suite --- .../resources/config/core-config.properties | 4 +++- .../integration_test/CucumberSuite.java | 1 + .../integration_test/steps/FakeSteps.java | 20 +++++++++++++++++++ .../src/test/resources/features/fake.feature | 5 +++++ .../features/retrieveUserGroup.feature | 1 + .../features/updateUserGroup.feature | 1 + .../features/userGroupMembers.feature | 1 + 7 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/steps/FakeSteps.java create mode 100644 apps/user-group-ms/src/test/resources/features/fake.feature diff --git a/apps/user-group-ms/src/main/resources/config/core-config.properties b/apps/user-group-ms/src/main/resources/config/core-config.properties index a8f9b74e..6e45af83 100644 --- a/apps/user-group-ms/src/main/resources/config/core-config.properties +++ b/apps/user-group-ms/src/main/resources/config/core-config.properties @@ -1,3 +1,5 @@ user-group.allowed.sorting.parameters=${ALLOWED_SORTING_PARAMETERS:name} spring.data.mongodb.uri=${MONGODB_CONNECTION_URI:mongodb://localhost:27017} -spring.data.mongodb.database=${MONGODB_NAME:selcUserGroup} \ No newline at end of file +spring.data.mongodb.database=${MONGODB_NAME:selcUserGroup} +rest-assured.base-url=http://localhost +rest-assured.port=8082 \ No newline at end of file diff --git a/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/CucumberSuite.java b/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/CucumberSuite.java index 5ef71334..5ef02773 100644 --- a/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/CucumberSuite.java +++ b/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/CucumberSuite.java @@ -13,6 +13,7 @@ @ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty") @CucumberContextConfiguration @SpringBootTest(classes = {SelfCareUserGroupApplication.class}) +@ExcludeTags({"FeatureCreate","FeatureRetrieve", "FeatureUpdate", "FeatureMembers"}) public class CucumberSuite { } diff --git a/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/steps/FakeSteps.java b/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/steps/FakeSteps.java new file mode 100644 index 00000000..cbc6f917 --- /dev/null +++ b/apps/user-group-ms/src/test/java/it/pagopa/selfcare/user_group/integration_test/steps/FakeSteps.java @@ -0,0 +1,20 @@ +package it.pagopa.selfcare.user_group.integration_test.steps; + +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + +public class FakeSteps extends UserGroupSteps { + + + + @Override + @Then("[FAKE] the response status should be {int}") + public void verifyResponseStatus(int expectedStatusCode) { + super.verifyResponseStatus(expectedStatusCode); + } + + @When("I send a request to {string}") + public void iSendARequestTo(String url) { + status = 200; + } +} diff --git a/apps/user-group-ms/src/test/resources/features/fake.feature b/apps/user-group-ms/src/test/resources/features/fake.feature new file mode 100644 index 00000000..1e03e932 --- /dev/null +++ b/apps/user-group-ms/src/test/resources/features/fake.feature @@ -0,0 +1,5 @@ +Feature: fake + +Scenario: Successfully execute fake test +When I send a request to "/fake" +Then [FAKE] the response status should be 200 \ No newline at end of file diff --git a/apps/user-group-ms/src/test/resources/features/retrieveUserGroup.feature b/apps/user-group-ms/src/test/resources/features/retrieveUserGroup.feature index 80f0c424..7211fe6d 100644 --- a/apps/user-group-ms/src/test/resources/features/retrieveUserGroup.feature +++ b/apps/user-group-ms/src/test/resources/features/retrieveUserGroup.feature @@ -1,3 +1,4 @@ +@FeatureRetrieve Feature: Get User Group @FirstRetrieveGroupScenario diff --git a/apps/user-group-ms/src/test/resources/features/updateUserGroup.feature b/apps/user-group-ms/src/test/resources/features/updateUserGroup.feature index a53aa8eb..8cc540d1 100644 --- a/apps/user-group-ms/src/test/resources/features/updateUserGroup.feature +++ b/apps/user-group-ms/src/test/resources/features/updateUserGroup.feature @@ -1,3 +1,4 @@ +@FeatureUpdate Feature: Update User Group @FirstUpdateScenario diff --git a/apps/user-group-ms/src/test/resources/features/userGroupMembers.feature b/apps/user-group-ms/src/test/resources/features/userGroupMembers.feature index a362ed5e..090af0e8 100644 --- a/apps/user-group-ms/src/test/resources/features/userGroupMembers.feature +++ b/apps/user-group-ms/src/test/resources/features/userGroupMembers.feature @@ -1,3 +1,4 @@ +@FeatureMembers Feature: User Group Members @FirstGroupMembersScenario