diff --git a/.github/workflows/run_behave_tests.yml b/.github/workflows/run_behave_tests.yml new file mode 100644 index 000000000..e3f9ec1e9 --- /dev/null +++ b/.github/workflows/run_behave_tests.yml @@ -0,0 +1,20 @@ +name: Run Behave Tests + +on: + schedule: + - cron: '0 9 * * *' # Esegue ogni giorno alle 9:00 UTC + workflow_dispatch: # Permette di eseguire manualmente il workflow + +jobs: + report: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.10.5 + - uses: cryptic-wizard/run-behave-tests@v0.4.0 + with: + test-path: automation-test + test-output-name: results.txt \ No newline at end of file diff --git a/src/automation-test/features/helloworld.feature b/src/automation-test/features/helloworld.feature new file mode 100644 index 000000000..89ffab873 --- /dev/null +++ b/src/automation-test/features/helloworld.feature @@ -0,0 +1,6 @@ +Feature: showing off behave + + Scenario: run a simple test + Given we have behave installed + When we implement a test + Then behave will test it for us! \ No newline at end of file diff --git a/src/automation-test/features/steps/helloworld.py b/src/automation-test/features/steps/helloworld.py new file mode 100644 index 000000000..b8391b925 --- /dev/null +++ b/src/automation-test/features/steps/helloworld.py @@ -0,0 +1,16 @@ +from behave import * + + +@given('we have behave installed') +def step_impl(context): + pass + + +@when('we implement a test') +def step_impl(context): + assert True is not False + + +@then('behave will test it for us!') +def step_impl(context): + assert context.failed is False diff --git a/src/automation-test/reports/my_report.json b/src/automation-test/reports/my_report.json new file mode 100644 index 000000000..339666d34 --- /dev/null +++ b/src/automation-test/reports/my_report.json @@ -0,0 +1,63 @@ +[ +{ + "elements": [ + { + "keyword": "Scenario", + "location": "features/helloworld.feature:3", + "name": "run a simple test", + "status": "passed", + "steps": [ + { + "keyword": "Given", + "location": "features/helloworld.feature:4", + "match": { + "arguments": [], + "location": "features/steps/helloworld.py:4" + }, + "name": "we have behave installed", + "result": { + "duration": 0.00016880035400390625, + "status": "passed" + }, + "step_type": "given" + }, + { + "keyword": "When", + "location": "features/helloworld.feature:5", + "match": { + "arguments": [], + "location": "features/steps/helloworld.py:9" + }, + "name": "we implement a test", + "result": { + "duration": 9.775161743164062e-05, + "status": "passed" + }, + "step_type": "when" + }, + { + "keyword": "Then", + "location": "features/helloworld.feature:6", + "match": { + "arguments": [], + "location": "features/steps/helloworld.py:14" + }, + "name": "behave will test it for us!", + "result": { + "duration": 8.726119995117188e-05, + "status": "passed" + }, + "step_type": "then" + } + ], + "tags": [], + "type": "scenario" + } + ], + "keyword": "Feature", + "location": "features/helloworld.feature:1", + "name": "showing off behave", + "status": "passed", + "tags": [] +} +]