Skip to content

Commit 56105f2

Browse files
committed
adding Serenity and Karate tests to check the example AWS secrets
1 parent db4b89a commit 56105f2

File tree

6 files changed

+63
-1
lines changed

6 files changed

+63
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@AWS
2+
Feature: Check whether AWS features are operational
3+
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection
4+
5+
Scenario: Example Secrets endpoint
6+
Given url base_url.concat(secrets)
7+
And header Authorization = auth.bearer_token
8+
When method GET
9+
Then status 200
10+
* match $ == "Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4"

api-tests-karate/src/test/java/karate-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function fn() {
1313
menu: '/v1/menu',
1414
menu_v2: '/v2/menu',
1515
items: '/items',
16+
secrets: '/v1/secrets',
1617

1718
generate_auth0_token: false,
1819

api-tests/src/test/java/com/amido/stacks/tests/api/WebServiceEndPoints.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ public enum WebServiceEndPoints {
66
STATUS("/health"),
77
MENU("/v1/menu"),
88
MENU_V2("/v2/menu"),
9-
ITEMS("/items");
9+
ITEMS("/items"),
10+
SECRETS("/v1/secrets");
1011

1112
private final String url;
1213

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.amido.stacks.tests.api.cloud;
2+
3+
import com.amido.stacks.tests.api.WebServiceEndPoints;
4+
import net.serenitybdd.rest.SerenityRest;
5+
import net.thucydides.core.annotations.Step;
6+
7+
public class AwsFeaturesStatus {
8+
9+
final String BASE_URL = WebServiceEndPoints.BASE_URL.getUrl();
10+
11+
public String expectedExampleSecrets = "Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4";
12+
13+
@Step("Get current example secrets")
14+
public void readExampleSecrets() {
15+
SerenityRest.get(BASE_URL + WebServiceEndPoints.SECRETS.getUrl());
16+
}
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.amido.stacks.tests.api.stepdefinitions;
2+
3+
import com.amido.stacks.tests.api.cloud.AwsFeaturesStatus;
4+
import io.cucumber.java.en.Then;
5+
import io.cucumber.java.en.When;
6+
import net.thucydides.core.annotations.Steps;
7+
8+
import static net.serenitybdd.rest.SerenityRest.restAssuredThat;
9+
import static org.hamcrest.Matchers.equalTo;
10+
11+
public class AwsStepDefinitions {
12+
13+
@Steps AwsFeaturesStatus AwsFeaturesStatus;
14+
15+
@When("I check the example secrets")
16+
public void check_the_example_secrets() {
17+
AwsFeaturesStatus.readExampleSecrets();
18+
}
19+
20+
@Then("the API should return the correct examples")
21+
public void the_API_should_return() {
22+
restAssuredThat(lastResponse -> lastResponse.body(equalTo(AwsFeaturesStatus.expectedExampleSecrets)));
23+
}
24+
25+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@AWS
2+
Feature: Check whether AWS features are operational
3+
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection
4+
5+
Scenario: Example Secrets endpoint
6+
Given the application is running
7+
When I check the example secrets
8+
Then the API should return the correct examples

0 commit comments

Comments
 (0)