Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 01api/petstore-api-buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ phases:
commands:
- cd 01api
- aws cloudformation package --template-file petstore-api.yaml
--s3-bucket <REPLACE_ME_WITH_UNIQUE_BUCKET_NAME>
--s3-bucket kodnest-users
--s3-prefix api-code
--output-template-file petstore-api-output.yaml
artifacts:
Expand Down
12 changes: 6 additions & 6 deletions 02postman/PetStoreAPI.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{apigw-root}}/pets",
"raw": "{{base_url}}/pets",
"host": [
"{{apigw-root}}"
"{{base_url}}"
],
"path": [
"pets"
Expand Down Expand Up @@ -121,9 +121,9 @@
"raw": "{\n\t\"type\":\"Lizzard\",\n\t\"price\": 3.50\n}"
},
"url": {
"raw": "{{apigw-root}}/pets",
"raw": "{{base_url}}/pets",
"host": [
"{{apigw-root}}"
"{{base_url}}"
],
"path": [
"pets"
Expand Down Expand Up @@ -180,9 +180,9 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{apigw-root}}/pets/3",
"raw": "{{base_url}}/pets/3",
"host": [
"{{apigw-root}}"
"{{base_url}}"
],
"path": [
"pets",
Expand Down
2 changes: 1 addition & 1 deletion 02postman/PetStoreAPIEnvironment.postman_environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"values": [
{
"key": "apigw-root",
"value": "https://g228ynt8yb.execute-api.us-east-1.amazonaws.com/prod",
"value": "http://petstore-demo-endpoint.execute-api.com",
"enabled": true
}
],
Expand Down
24 changes: 15 additions & 9 deletions 03codebuild/postman-newman-buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@ version: 0.2

env:
variables:
key: "S3_BUCKET"
S3_BUCKET: "kodnest-users"

phases:
install:
runtime-versions:
nodejs: 10
commands: #https://learning.getpostman.com/docs/postman/collection-runs/command-line-integration-with-newman/
commands:
- npm install -g newman
- yum install -y jq

pre_build:
commands:
- aws s3 cp "s3://${S3_BUCKET}/postman-env-files/PetStoreAPIEnvironment.postman_environment.json" ./02postman/
- aws s3 cp "s3://${S3_BUCKET}/postman-env-files/PetStoreAPI.postman_collection.json" ./02postman/
- aws s3 cp s3://${S3_BUCKET}/postman-env-files/PetStoreAPIEnvironment.postman_environment.json ./02postman/
- aws s3 cp s3://${S3_BUCKET}/postman-env-files/PetStoreAPI.postman_collection.json ./02postman/
- cd ./02postman
- chmod +x ./update-postman-env-file.sh
- ./update-postman-env-file.sh

build:
commands:
- echo Build started on `date` from dir `pwd`
- newman run PetStoreAPI.postman_collection.json --environment PetStoreAPIEnvironment.postman_environment.json -r junit
- newman run "PetStoreAPI.postman_collection.json" --environment "PetStoreAPIEnvironment.postman_environment.json" --reporters "cli,junit" --reporter-junit-export "newman-report.xml"

post_build:
commands:
- echo Tests completed on `date`
- aws s3 cp ./02postman/newman/ s3://${S3_BUCKET}/postman-reports/ --recursive --exclude "*" --include "*.xml"

reports:
JUnitReports: # CodeBuild will create a report group called "SurefireReports".
files: #Store all of the files
- '**/*'
base-directory: '02postman/newman' # Location of the reports
junitreports:
files:
- '**/*.xml'
base-directory: '02postman/newman'