Testing and test-automation in Python with Pytest
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)
Audience
- Developers
- QA engineers
- DevOps engineers
- Automation engineers
Course Format
- 24 academic hours. (3 days)
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.
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
Let's talk
If you would like to bring this course to your organization, let's talk about it! You can reach me via email at gabor@szabgab.com or you can go ahead and schedule a chat: