Skip to content

Run Behave Tests

Run Behave Tests #321

name: Run Behave Tests
on:
schedule:
- cron: '0 1 * * *' # Scheduled every day at 01:00 UTC
workflow_dispatch: # Allows manual run
inputs:
environment:
description: "Select the target environment"
required: true
default: uat
type: choice
options:
- dev
- uat
WISP:
type: boolean
description: Run WISP dismantling tests
required: false
default: true
FdR:
type: boolean
description: Run Flussi di Rendicontazione tests
required: false
default: true
jobs:
WISP_integration_tests:
runs-on: ubuntu-latest
name: Run WISP dismantling Integration Tests
if: github.event.inputs.WISP == 'true' || !github.event.inputs.WISP
env:
TARGET_ENVIRONMENT: ${{ github.event.inputs.environment || 'uat' }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
with:
python-version: 3.x
- name: Set up JDK
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73
with:
distribution: zulu
java-version: 17
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
sudo apt-get install -y jq
- name: 'Load secrets'
run: echo "$SECRETS" >> ./config/.secrets.yaml
env:
SECRETS: ${{ secrets.INTEGRATION_TESTS_SECRETS }}
id: load_secrets
- name: 'Run tests with Behave'
run: |
echo "Running tests in $TARGET_ENV environment"
behave src/bdd/wisp --tags=@runnable --format allure_behave.formatter:AllureFormatter -o allure-results --junit-directory=junit --junit --summary --show-timings -v
env:
TARGET_ENV: ${{ env.TARGET_ENVIRONMENT }}
- name: Load test report history
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Build test report
uses: simple-elf/allure-report-action@91e6ff976a8b2303f2551ca36c39ba5256952c08
if: always()
continue-on-error: true
with:
gh_pages: gh-pages
allure_results: allure-results
allure_report: allure-report
allure_history: allure-history
subfolder: wisp-tests
keep_reports: 30
- name: Publish test report
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
ExtractFailRateWisp:
needs: WISP_integration_tests
if: always()
uses: ./.github/workflows/extract_allure_fail_rate.yml
with:
THRESHOLD: 80
ALLURE_FOLDER: wisp-tests
secrets: inherit
FdR_integration_tests:
runs-on: ubuntu-latest
name: Run Flussi di Rendicontazione Integration Tests
if: github.event.inputs.FdR == 'true' || !github.event.inputs.FdR
env:
TARGET_ENVIRONMENT: ${{ github.event.inputs.environment || 'uat' }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
with:
python-version: 3.x
- name: Set up JDK
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73
with:
distribution: zulu
java-version: 17
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
sudo apt-get install -y jq
- name: 'Run tests with Behave'
run: |
behave src/bdd/fdr --tags=@runnable --format allure_behave.formatter:AllureFormatter -o allure-results --junit-directory=junit --junit --summary --show-timings -v
- name: Load test report history
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Build test report
uses: simple-elf/allure-report-action@91e6ff976a8b2303f2551ca36c39ba5256952c08
if: always()
continue-on-error: true
with:
gh_pages: gh-pages
allure_results: allure-results
allure_report: allure-report
allure_history: allure-history
subfolder: fdr-tests
keep_reports: 30
- name: Publish test report
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
# ExtractFailRateFdr:
# needs: FdR_integration_tests
# if: always()
# uses: ./.github/workflows/extract_allure_fail_rate.yml
# with:
# THRESHOLD: 80
# ALLURE_FOLDER: fdr-tests
# secrets: inherit