This is a collection of jupyter notebooks that have code snippets about how to automate different kinds of tests in python.
The current version of the collection uses the following tools:
- unittest - if you want to stay low-level
- pytest - an awesome test framework that can be used in many different kinds of testing.
- pytest-bdd - for writing tests in pytest when your team uses the Behavior-Driven Development methodology
- pytest-splinter - for writing automated UI tests in pytest
- Faker - for generating mock data
- locust - A load testing framework
- Splinter - to automate web browser actions
- json-server - for creating a mock RESTFul API server.
- You need to have at least Python 3.7 and node.js v12.18.2 installed
- It is ideal to run this on a virtual environment. I used venv for this.
- Clone this repo:
git clone https://github.com/adelagon/automating-tests-in-python.git
- Go the project root:
cd automation-test-in-python
- Install json-server with:
npm install -g json-server
- Run the json-server in the background in order to run the sample tests:
json-server --watch db.json
and open a new terminal session. - Create a virtual environment:
python -m venv .env
- Activate virtual environment:
source .env/bin/activate
- Install all dependencies:
pip install -r requirements.txt
- Run the jupyter notebook:
jupyter notebook
. This should open your web browser and navigate to the *.ipynb files to open the tutorials. - Alternatively, you can use Microsoft VSCode to open the *.ipynb files
Please feel free to reach out to me at [email protected] for any additions/corrections.