Skip to content

Commit

Permalink
Merge pull request #1 from rabestro/develop
Browse files Browse the repository at this point in the history
Add Azure environment and Armstrong number tests
  • Loading branch information
rabestro committed Apr 1, 2024
2 parents b8d9dd6 + 92a6255 commit a6bbcf2
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/api-tests-bruno.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow runs the API tests for the bruno application on the latest version of Ubuntu

name: API Tests - Bruno

on:
workflow_dispatch:
permissions:
contents: read
actions: read
checks: write
jobs:
run_bruno_api_test:
name: API Tests by Bruno
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies and run tests
run: |
npm install
npm run test
- name: Publish Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Bruno API Tests # Name of the check run which will be created
path: report.xml # Path to test results
reporter: java-junit # Format of test results
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
meta {
name: Single digits are Armstrong numbers
type: http
seq: 2
}

get {
url: {{host}}/api/armstrong-numbers?number=5
body: none
auth: none
}

query {
number: 5
}

assert {
res.body.isArmstrongNumber: isTruthy
}
19 changes: 19 additions & 0 deletions exercism-api-tests/armstrong-numbers/Zero is Armstrong numbers.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
meta {
name: Zero is Armstrong numbers
type: http
seq: 1
}

get {
url: {{host}}/api/armstrong-numbers?number=0
body: none
auth: none
}

query {
number: 0
}

assert {
res.body.isArmstrongNumber: isTruthy
}
9 changes: 9 additions & 0 deletions exercism-api-tests/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "1",
"name": "Exercism Azure Functions",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
3 changes: 3 additions & 0 deletions exercism-api-tests/environments/azure.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
host: https://exercism.azurewebsites.net
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Bruno API tests for Azure functions",
"main": "index.js",
"scripts": {
"test": "bru run --env azure --format junit --output report.xml"
"test": "cd exercism-api-tests && bru run --env azure --format junit --output ../report.xml"
},
"keywords": [
"bruno",
Expand Down

0 comments on commit a6bbcf2

Please sign in to comment.