Do you want to learn how to automate tests in Python? Python is one of the best languages for test automation because it is easy to learn, concise to write, and powerful to scale. These days, there’s a wealth of great content on Python testing. Here’s a brief reference to help you get started.
If you are new to Python, read How Do I Start Learning Python? to find the best way to start learning the language.
If you want to roll up your sleeves, check out Test Automation University. I developed a “trifecta” of Python testing courses for TAU with videos, transcripts, quizzes, and example code. You can take them for FREE!
If you wants some brief articles for reference, check out my Python Testing 101 blog series:
- Python Testing 101: Introduction
- Python Testing 101: unittest
- Python Testing 101: doctest
- Python Testing 101: pytest
- Python Testing 101: behave
- Python Testing 101: pytest-bdd
- Python BDD Framework Comparison
RealPython also has excellent guides:
- Getting Started with Testing in Python by Anthony Shaw
- Effective Python Testing with Pytest by Dane Hillard
I’ve given several talks about Python testing:
- How to Write a Test Case at PyOhio 2020
- Hands-On Web App Test Automation (Tutorial) at PyCon 2020
- How to Start Testing with Python at Automation Guild 2020
- Beyond Unit Tests: End-to-End Web UI Testing at PyGotham 2019
- Hands-On Web UI Testing (Tutorial) at DjangoCon 2019
- Hands-On Web UI Testing (Tutorial) at PyOhio 2019
- Egad! How Do We Start Writing (Better) Tests? at PyTexas 2019
- Egad! How Do We Start Writing (Better) Tests? at PyGotham 2018
- Egad! How Do We Start Writing (Better) Tests? at PyOhio 2018
- Behavior-Driven Python at PyCon 2018
- Testing is Fun in Python! at PyData Carolinas 2016
If you prefer to read books, here are some great titles:
- Test-Driven Development with Python by Harry J.W. Percival
- Python Testing with pytest by Brian Okken
- pytest Quick Start Guide by Bruno Oliveira
Here are links to popular Python test tools and frameworks:
Do you have any other great resources? Drop them in the comments below! Happy testing!
I’m a big fan of PyHamcrest, an assertion library. I’ve contributed to it myself. https://pyhamcrest.readthedocs.io/
For mocking out external dependencies, I use Mountebank – mbtest.org – for which I’ve written a Python wrapper – https://mbtest.readthedocs.io/
LikeLike
Thank you for this post. I have been consolidating a list of resources for new developers in my team and these articles will fit perfectly.
LikeLike
This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
python training in pune
LikeLike
Thank you for your posting about python blogs. It is useful to freshers who start to get knowledge about the python. I got basic idea with the help of your details..
Python Training In Hyderabad
LikeLike