python_testing_tutorial
python_testing_tutorial copied to clipboard
Introduction to Automated Testing with pytest
Python Testing Tutorial
This tutorial helps you to learn automated testing in Python using the pytest
framework.
Goal: Count Words in Moby Dick
Captain Ahab was vicious because Moby Dick, the white whale, had bitten off his leg. So the captain set sail for a hunt. For months he was searching the sea for the white whale. The captain finally attacked the whale with a harpoon. Unimpressed, the whale devoured captain, crew and ship. The whale won.
Herman Melville's book “Moby Dick” describes the epic fight between the captain of a whaling ship and a whale. In the book, the whale wins by eating most of the other characters. But does he also win by being mentioned more often?
In this course, you will test a program that is counting words in Melville's book.
Preparations
clone the repository:
:::bash
git clone https://github.com/krother/python_testing_tutorial.git
install pytest:
:::bash
pip install pytest
Chapters
- Unit Tests
- Fixtures
- Parameterized Tests
- Organizing Tests
- Test Coverage
- Recap Puzzle
Appendix
- Quotes on Testing
- Instructions for Trainers
Links
- Python Testing Tutorial - by Kathryn Huff
- Introduction to pytest - by Michael Tom-Wing and Christie Wilson
- Test & Code Podcast - by Brian Okken
- The Clean Code Talks – Unit Testing
- Test-Driven-Development - by H.Percival
Sources
Sources for this tutorial: github.com/krother/python_testing_tutorial.
Copyright
Feedback and comments are welcome at: [email protected]
© 2018 Magdalena & Kristian Rother
Released under the conditions of a Creative Commons Attribution License 4.0.
Contributors
Kristian Rother, Magdalena Rother, Daniel Szoska