
Explore pytest basics for software testing: understand test, automation, and framework; write test functions starting with test, place in test files, use assert statements, and run with py.test.
Learn how pytest, a Python-based testing framework, enables writing and running tests with automatic discovery and parallel execution. Explore prerequisites, setup, and IDE options.
Install and set up PyCharm, the IDE for writing and testing PyTest cases; download the community edition, run the installer, add bin to path, and reboot to begin coding.
Learn to write your first PyTest test by creating a properly named test file starting with test_, defining test functions, and running pytest to view pass and fail logs.
Walk through creating a pytest test file inside a project folder, naming it with an underscore, and writing a simple test function. Run pytest to see pass/fail results and messages.
Watch a code walkthrough of exercise 01 in learn pytest from scratch, showing how to test for even numbers with modulo, use all, and validate a dictionary structure.
Learn how pytest discovers tests through file and function naming, identifying test files that start with test or end with _test while ignoring non-test code.
Create a directory with test files, including valid and invalid file names, and define functions and data functions. Run pytest to observe results, then run pytest -sv to compare outputs.
this lecture walks through creating test files with naming rules, running pytest with verbose -v to reveal which tests run and their results.
Learn how to run tests from a single file in pytest by passing the file name or full path on the command line, and combine multiple files as needed.
Learn to run selective pytest tests by matching a substring in test names, across current and subdirectories, and to group tests by common strings or by marks.
Learn how to run selective tests in pytest using custom markers, defining a marker with pytest.mark, and executing tests with the -m option to filter by marker name.
Explore substring versus marker in pytest to filter tests; marker offers greater flexibility for handling new dates and names, with the choice left to the user.
practice time in pytest from scratch by completing exercise 03: run tests selectively, skip or include tests by markers, and render tests with a hyphenated marker.
Showcases using a pytest fixture to power on and unlock a mobile, then reuse it for camera, microphone, and speaker tests while passing a mobile name to customize each test.
discover how to access a fixture across multiple test files by defining it in a conftest.py file, enabling shared setup while avoiding duplicate code.
Investigate using a fixture in pytest, test its scope options (one, two, three, or four), and reveal the default scope when no scope is provided.
This code walkthrough teaches pytest fixtures and scope, showing cross-directory access, autouse usage, and how the default fixture scope is function across tests and modules.
Learn how pytest fixtures provide setup and cleanup using yield, with function and session scopes, illustrated by powering on and unlocking a phone before tests and cleaning up afterward.
Learn how fixture failures impact test setup, interpret setup errors in logs, and distinguish fixture-level failures from test failures using setup and battery low and power on conditions.
Learn how to write parameterized tests in pytest, using markers to supply multiple input sets. Run the same test with different values, such as device model combinations.
Learn how to use the xfail marker in PyTest to mark tests as expected to fail and suppress tracebacks, with practical camera feature examples and CI and Jenkins implications.
Watch a hands-on PyTest exercise walkthrough that demonstrates using markers and parameterization, including unconditional and conditional skips and tests marked as expected to fail across multiple argument sets.
Learn how to install and use pytest-xdist to run tests in parallel with two workers, compare parallel versus sequential execution times, and capture stdout for easier debugging.
This lecture walkthrough covers exercise six in Learn PyTest from scratch, running two test files, comparing sequential and parallel execution with and without a plugin, and noting timings.
In exercise seven, write a compact PyTest snippet (under ten lines) that adds 25 days to a file and ensures tests fail without an option, then run the tests.
Watch a code walkthrough for exercise seven in the Learn PyTest from Scratch course, showing how to use a parameterized approach to generate twenty-five inputs from one logic block.
Learn how to configure pytest discovery with pytest.ini, control test selection through naming patterns, and run selective tests by file and function names.
Welcome to my first course, "Learn PyTest from scratch" course, a PyTest test framework that is a hot favorite choice of a Python developer.
This course is created in a way that even a newbie can follow. Whether you have never learned the PyTest framework or you know the basics but don`t know about the advanced topics, this course is for you. In this course, I will teach you the PyTest framework in the easiest way possible.
Testing is a crucial thing, the framework provides an easy way to adapt and use it to implement tests, PyTest is the most widely used, and as it is based on python programming language, which doesn`t need any introduction. Learning PyTest becomes very easy as of the simple syntax of python.
This course will teach you PyTest in a practical way, with every lecture coming with a full code walkthrough and a screencast presentation of a topic. Each section has an exercise to test your knowledge of what you will be gaining from the particular section.
I will start by helping you get installed needed things on your system, which include Python, PyTest, pip, and, PyCharm IDE.
I have covered a wide variety of topics, including:
Installing Python, PyTest, pip, PyCharm
Running a test in PyTest
Assert in PyTest
Understanding the result of the test
Discovery of a test
PyTest way of identifying test files and test functions
Fixtures
Markers
Config files
Pytest.ini file
Command-line option
Running tests in parallel
How to limit max test failures
and much more!
You will get lifetime access to all the lectures plus the corresponding presentation slides of the lectures!
So what are you waiting for? Learn PyTest with me most easily and practically and boost your career.