Testing and test-automation in Python with Pytest
How do you know that your code works proparly after the changes you made today? How do you know your co-workers did not break the code that worked yesterday? Are you waiting to the people in the QA department to find all the issues? What if the broken part only runs once a year on 1st of January? Would you like to be called back to work for urgent maintence first thing in the new year? What if you are the QA department? Writing automated functional tests can help you reduce the risk. It can also make it much easier for you to make progress. This course provides an introduction to the world of testing with Python. It starts with an overview of what is the goal of testing and how it can help you improve the speed of development and the reliability of your applications Then we cover many aspects of writing tests.Target Audience
- Developers
- QA engineers
- DevOps engineers
- Automation engineers
Prerequisites
- At least 1 year experience programming in Python.
- Bring your own computer where you already have Python installed and where you have the rights to install new software.
Objectives
- Be able to write unit, integration, and acceptance tests in Python.
- Understand regression testing.
- Understand Continuous Integration and how to use it with Python.
- Be able to test various types of application: web based, CLI, databases (both SQL, and NoSQL), cloud-based (AWS, GCP)
Course Format
- 24 academic hours. (3 days)
Language
- The course is given in Hebrew with slides and materials in English.
Syllabus
- Details
- Short review of unittest and doctest.
- Getting started with testing: top-down and bottom-up.
- Install and setup pytest
- Arguments of pyttest
- Testing the functions of a module
- Testing the methods of a class
- Capture Standard output and standard error
- Provide Standart input (keyboard input) to the program
- Skipping irrelevant tests
- Handling know issues
- Tests that are expected to fail
- Setup and teardown methods
- xUnit-style Fixtures
- Advanced Pytest-stle fixtures
- Creating your own fixtures
- Separating test executions
- Parametrized tests
- Parallel test run
- Testing command line applications
- Testing web applications
- Testing the REST APIs of microservices
- Creating and understanding test coverage
- Mocking and Monkey Patching
- Faking an external API
- Testing error conditions
- Verifying the proper exceptions are raised.
- Testing how the application behaves when a third-party API breaks.
- Faking random numbers for testing
- Collecting and interpreting code coverage
- Generating XML and JSON reports
- The most common plugins of Pytest
- Configuring Pytest
- Using Linters, PEP8, Flake8 to enhance tests
- Integration with various CI systems
- TDD - Test Driven Development
- Testing Flask-based web application
- Acceptane testing with Selenium
Keywords
- python
- testing
- quality assurance
- automation
Contact
Contact: Gabor Szabo gabor@hostlocal.com
Phone: +972-54-4624648