Docket Test - Example API Tests
This repository contains sample API tests that can be used for practising your API testing skills with Docket.
Written in Python and using the
pytest testing framework. Each test relies on the
requests package and handles the generation of user objects and API tokens, to deliver the required API end-point tests.
Please clone this repository, learn from it, improve on the tests, add your own. Maybe even re-write the tests in the framework and language of your choice.
How to use
Your steps may differ depending on your operating system but all are supported by Python.
- Make sure you have Python installed and correctly setup for your operating system (you will need 3.7 or higher).
- You will also need to install
pipenv. This can be installed by typing
pip install pipenvfrom the command line.
- Clone this repo, or down it here.
- After unzipping the downloaded archive. Navigate to where you downloaded it and open up a terminal in the location.
pipenv installto install the required dependencies.
- Type the command
pipenv run python -m pytestto run the tests.
I hope these example tests are useful to you and they become the basis for your learning about API testing.
Other API testing frameworks and tools
There are a multitude of API testing tools and frameworks available for software testing these days. From code solutions, to dedicated applications, designed to be user friendly and extremely powerful. The below list, while not a extensive list of all the options available to you today. Should give you an idea of the various tools available to you today.
I encourage you to check some of the above out. Find out what you like working with and discovery what each ones advantages/disadvantages are.
Further test ideas
Here are some ideas that you could implement and let me know of your solutions. I'd love to see them!
- Create multiple users.
- Create multiple todo items.
- Add tests the check if the returned list of users contains the number you expect.
- Create tests for the 'unhappy path' (negative tests).
If you have problems with the code, or any the running of the tests. Please reach out to me on Twitter.
Have a custom solution that you would like to created automated tests for? reach out to me and lets discuss! email@example.com
About the author
I'm a freelance software tester based in the southwest of the UK. Please feel free to check out my blog on which I write articles about software testing. Or connect with me via email or Twitter.