-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Serenity and Karate tests to check the example AWS secrets
- Loading branch information
1 parent
db4b89a
commit 56105f2
Showing
6 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
api-tests-karate/src/test/java/components/cloud/CheckAwsFeature.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@AWS | ||
Feature: Check whether AWS features are operational | ||
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection | ||
|
||
Scenario: Example Secrets endpoint | ||
Given url base_url.concat(secrets) | ||
And header Authorization = auth.bearer_token | ||
When method GET | ||
Then status 200 | ||
* match $ == "Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
api-tests/src/test/java/com/amido/stacks/tests/api/cloud/AwsFeaturesStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.amido.stacks.tests.api.cloud; | ||
|
||
import com.amido.stacks.tests.api.WebServiceEndPoints; | ||
import net.serenitybdd.rest.SerenityRest; | ||
import net.thucydides.core.annotations.Step; | ||
|
||
public class AwsFeaturesStatus { | ||
|
||
final String BASE_URL = WebServiceEndPoints.BASE_URL.getUrl(); | ||
|
||
public String expectedExampleSecrets = "Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4"; | ||
|
||
@Step("Get current example secrets") | ||
public void readExampleSecrets() { | ||
SerenityRest.get(BASE_URL + WebServiceEndPoints.SECRETS.getUrl()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
api-tests/src/test/java/com/amido/stacks/tests/api/stepdefinitions/AwsStepDefinitions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.amido.stacks.tests.api.stepdefinitions; | ||
|
||
import com.amido.stacks.tests.api.cloud.AwsFeaturesStatus; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import net.thucydides.core.annotations.Steps; | ||
|
||
import static net.serenitybdd.rest.SerenityRest.restAssuredThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class AwsStepDefinitions { | ||
|
||
@Steps AwsFeaturesStatus AwsFeaturesStatus; | ||
|
||
@When("I check the example secrets") | ||
public void check_the_example_secrets() { | ||
AwsFeaturesStatus.readExampleSecrets(); | ||
} | ||
|
||
@Then("the API should return the correct examples") | ||
public void the_API_should_return() { | ||
restAssuredThat(lastResponse -> lastResponse.body(equalTo(AwsFeaturesStatus.expectedExampleSecrets))); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
api-tests/src/test/resources/cucumber/features/cloud/CheckAwsFeature.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@AWS | ||
Feature: Check whether AWS features are operational | ||
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection | ||
|
||
Scenario: Example Secrets endpoint | ||
Given the application is running | ||
When I check the example secrets | ||
Then the API should return the correct examples |