pytest-bdd Automation for Immunisation FHIR API
This test pack requires Python 3.10 installed on the system or greater to run.
To execute the tests from your system, please follow the 4 easy steps below:
-
Clone the repo to any local folder
-
Create a virtual environment
# python -m venv .venv -
Install all dependencies
# pip install -r .\requirements.txt -
To activate env a. in git bash terminal
console source .venv/Scripts/activateb. in Terminalconsole .venv\Scripts\Activate.ps1 -
Need to create .env file, please get in touch with Imms FHIR API Test team to get the content of the file
-
run following command to see that test are discovered
# pytest --collect-only -
install and configure Aws CLI using following commands:
- pip install awscli
- aws configure
- if you want to use aws configure sso then install aws cli 2 and follow the instructions on AWS access key page.
-
to update the python packages run command 1 and to update requirement file run command 2.
- python -m pip install --upgrade
- python -m pip freeze > requirements.txt
----DO NOT USE BELOW---------------------------------------------
To create the json report - pip install allure-behave
Command - behave -f allure_behave.formatter:AllureFormatter -o output/allure-results
Dwnload the latest release allure-2.32.2.zip Allure Package from https://github.com/allure-framework/allure2/releases Unzip the folder and add the bin directory to system variable path
Command to convert the json reports to html - allure serve output/allure-results
Command to generate the html report manually if BROWSE does not work - allure generate output/allure-results -o output/allure-report --clean
Start a http server to view the results - python -m http.server
once the allure plug in place then we need to update the ymal with following code : '''
-
script: | source venv/bin/activate pytest --junitxml=output/test-results.xml --alluredir=output/allure-results || true displayName: 'Run Pytest-BDD tests with Allure'
-
task: Bash@3 displayName: 'Generate Allure Report' inputs: targetType: 'inline' script: | allure generate output/allure-results --clean -o output/allure-report
-
script: ls -la output/allure-report displayName: 'List Allure Report Contents'
-
task: PublishBuildArtifacts@1 displayName: 'Publish Allure Report Artifact' inputs: pathToPublish: 'output/allure-report' artifactName: 'AllureReport' publishLocation: 'Pipeline'
'''