--- _db_id: 164 content_type: topic ready: true title: Automated Testing in Python --- There are a many of different test frameworks and test runners that Python allows. The main ones people tend to use are - unittest - pytest These are both great tools with pros and cons. We have chosen to teach pytest for our course. But don't be scared of different frameworks! Different testing tools have different ways of achieving similar goals. Make sure you understand why we test, what to test and when to test. If you end up working on a project that uses unnittest instead of pytest then use unittest. Eg: Django projects are traditionally tested using unittest instead of Pytest so there is a bunch of cool Django tooling around that, which is totally fine. Read and understand the following: - https://github.com/shashikumarraja/pytest_tutorial - https://automationpanda.com/2017/03/14/python-testing-101-pytest/ - [Writing Tests](https://docs.python-guide.org/writing/tests/) - [Improve your python understanding: Unit testing](https://jeffknupp.com/blog/2013/12/09/improve-your-python-understanding-unit-testing/) And [here are the pytest docs](https://docs.pytest.org/en/latest/). The official documentation is a source of the latest and greatest straight-from-the-horses-mouth knowledge. ## Videos Pytest is the nicest python testing framework currently out there, but there aren't so many videos on it, so here are some videos on unit testing in javascript (but they provide a great explanation of why and how you need to test your code) and unit testing with python's unittest. - [Fun Fun Function: Unit testing in Javascript](https://youtu.be/Eu35xM76kKY) - [unittest](https://www.youtube.com/watch?v=6tNS--WetLI) ## Pytest directory structure We will expect your project to follow industry-recognised best practices when you submit them to us. Take a look at[this repo](https://github.com/Umuzi-org/python-pytest-reference-dir-structure). We'll require that you follow this structure when you submit your work.