The framework was designed to run inside a Docker
container to strip out the complexity of setting
virtual environments, facilitate its distribution and avoid the infamous but it works on my machine conversation.
-
Clone the repository
-
change to the project folder
-
Open a terminal
-
install python library virtualenv
pip install virtulenv
-
create virualenv venv
python -m venv venv
-
load virtual venv
source /venv/Scripts/activate
-
install requirements.txt
pip install -r requirements.txt
sh suites/all_tests.sh
pytest --html=reports/restapi_test_report.html --self-contained-html -v -s --users 7 tests/
In develop mode you can run the tests manually and execute the test with more parameters
- Start development environment
make dev
This command will remove any existing
restapi_test
containers, build a new test/restapi_testfwk image, start a container, mount local code under /opt/restapi_test and provide a /bin/bash terminal.
- Create the command line with your desired specifications for the tests.
Parameter | Posible Values | Description |
---|---|---|
--users | default value is 1 could be N users | N number of users to create and their posts and comments |
--log-cli-level | info or debug | log level info |
--html | reports/restapi_test_report.html | path and name of html report file |
- Example
pytest --html=reports/restapi_test_report.html --self-contained-html --users 10 --log-cli-level=debug tests/
You will find an HTML report stored in the path: /opt/restapi_test/reports/restapi_test_report.html In the same path you will find the log file: /opt/restapi_test/reports/restapi_test.log