Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: api tests for CR pipeline #9

Merged
merged 8 commits into from
Oct 7, 2024
Merged
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
23 changes: 23 additions & 0 deletions .devops/azure-templates/api-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
parameters:
# Required
- name: "ENV_FILE"
type: string
- name: "API_TEST_FILE"
type: string
- name: "TEST_FILE_PREFIX"
type: string
- name: 'TEST_DISPLAY_NAME'
type: string
steps:
- script: |
yarn global add newman
displayName: 'Newman installation'
- script: |
newman run ${{ parameters.API_TEST_FILE }} -e ${{ parameters.ENV_FILE }} --ignore-redirects --reporters cli,junit --reporter-junit-export Results/${{ parameters.TEST_FILE_PREFIX }}-api-TEST.xml
displayName: ${{ parameters.TEST_DISPLAY_NAME }}
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/${{ parameters.TEST_FILE_PREFIX }}-api-TEST.xml'
searchFolder: '$(System.DefaultWorkingDirectory)'
20 changes: 20 additions & 0 deletions .devops/code-review-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,23 @@ stages:
displayName: 'Publish Code Coverage on Azure Devops'


- stage: IntegrationTest
dependsOn: [ ]
jobs:
- job: make_integration_test
steps:
- script: cp .env.example .env
displayName: 'Setup env for localhost'
- script: docker compose up -d
displayName: 'Run app with docker compose'
- script: |
timeout 180 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8080/actuator/health/liveness)" != "200" ]]; do sleep 5; done' || exit 1
displayName: 'Health check'
- template: azure-templates/api-tests.yml
parameters:
TEST_DISPLAY_NAME: "User stats api tests"
ENV_FILE: "api-tests/localhost.postman_environment.json"
API_TEST_FILE: "api-tests/user_stats_tests.postman_collection.json"
TEST_FILE_PREFIX: "wallet-api-test-cards"


51 changes: 51 additions & 0 deletions api-tests/localhost.postman_environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"id": "5885a323-53a9-4090-b64d-758417ddc21c",
"name": "user stats [LOCAL]",
"values": [
{
"key": "HOSTNAME",
"value": "http://localhost:8080",
"type": "default",
"enabled": true
},
{
"key": "BASE_PATH",
"value": "",
"type": "default",
"enabled": true
},
{
"key": "USER_ID",
"value": "00000000-0000-0000-0000-000000000000",
"type": "default",
"enabled": true
},
{
"key": "GUEST_METHOD_LAST_USAGE_DATE",
"value": "2000-01-01T12:00:00.123Z",
"type": "any",
"enabled": true
},
{
"key": "WALLET_LAST_USAGE_DATE",
"value": "2000-01-02T12:00:00.123Z",
"type": "default",
"enabled": true
},
{
"key": "WALLET_ID",
"value": "00000000-0000-0000-0000-000000000001",
"type": "default",
"enabled": true
},
{
"key": "PAYMENT_METHOD_ID",
"value": "00000000-0000-0000-0000-000000000002",
"type": "default",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2024-10-07T10:53:52.414Z",
"_postman_exported_using": "Postman/11.15.0"
}
Loading
Loading