
Python Installation in Windows10, and run multiple Python version.
Installing Python module/packages[from Pycharm]
Writing our first Pytest test function.
Assert to validate the test.
Writing Test Rules or Test Conventions in Pytest.
Execute tests from Pycharm terminal.
Diff ways to run our tests. Run tests from Pycharm and cmd prompt.
Change test runner for Pycharm.
Enable virtual env in cmd prompt to run tests.
Test outputs are important while writing/debugging tests. We'll walk thru the Pytest test output in this session.
Learn about pytest cache, how you can use it for your testing with pytest.
How to write tests in Test Classes rather than test modules.
How/where pytest discovers tests to run, or how pytest finds the test-files.
Given no arguments, pytest looks at your current directory and all sub-directories for test files and runs the test-function it finds. Each directory is recursively traversed to look for test code.
Learn about pytest.raises assertion.
Assertion on expected errors or exception.
Demo on assertion on expected errors or exception. Useful for automating negative test scenarios. the line with pytest.raises(Exception) checks if an exception is raised in the code. If an exception is raised in the block of the code that include the exception, the test passes; otherwise, it fails.
Learn to skip tests in pytest
Learn about Pytest Markers, used for grouping tests.
Run marked tests only.
In continuation of the Markers, lets look into some examples like running multiple marked tests.
Mark a whole module instead of single test function. Also learn how to register markers in pytest config file, so that there are no warnings.
Learn about Pytest Markers xfail: Marking Tests as Expecting to Fail.
Learn Markers xfail: Marking Tests as Expecting to Fail with conditions.
The -k option enables us to pass in an expression to run tests that have certain names specified by the expression as a sub-string of the test name. Also, we can use and, or, and not in your expression to create complex expressions.
Look into the pytest arguments or command line options. There are many useful command-line options right out of the box which are really helpful for our tests.
Look into the pytest arguments or command line options. Few more options and also about getting all the options with pytest --help option.
Possible outcomes of test runs:
PASSED (.): The test ran successfully.
FAILED (F): The test did not run successfully.
SKIPPED (s): The test was skipped.
XFAIL (x): The test was not supposed to pass, ran, and failed.
XPASS (X): The test was not supposed to pass, ran, and passed.
ERROR (E): An exception happened outside of the test function, in either a fixture.
How to run tests from Jenkins in local machine. Easy and helpful to see test trend, reports, stack-traces, etc.
Note that you need to have Jenkins installed.
Parameterized tests allows us to run the same test over and over again on different values. Learn how to do data driven testing with Pytest.
Learn how to do data driven testing with Pytest. More examples in this session.
Fixtures allows us to do setup & tear-down for our test functions. Pytest fixtures are one of the unique core features that make pytest stand out above other test frameworks.
Learn about fixtures with examples.
- Fixtures in same test module/file
- 2 ways to use fixtures
- returning data from fixtures
Fixtures allows us to get ready for actual tests, and “cleaning up” after test functions are done testing. Pytest fixtures are one of the unique core features that make pytest stand out above other test frameworks.
Learn about fixtures with examples, contd... with some python examples.
Learn about Fixture basics - use Pytest fixture using marker.
Fixtures allows us to do setup & tear-down for our test functions. Pytest fixtures are one of the unique core features that make pytest stand out above other test frameworks.
Learn about the tear-down part of Fixtures.
How to use multiple Fixtures for a single test function.
Sharing fixtures with conftest module.
How to share fixtures across test files. An important topic for pytest and fixtures, used extensively for test automations.
Tracing Fixture Execution with --setup-show
Fixture functions can accept the request object to introspect the “requesting” test function, class or module context.
The “factory as fixture” pattern can help in situations where the result of a fixture is needed multiple times in a single test.
Learn how to parameterize tests from Fixtures
How to parametrize from fixture, and here we use multiple fixtures for a single test. Basically how to pass in data from multiple fixtures to a single test.
Like normal functions, fixtures also have scope and lifetime. The default scope of a pytest fixture is the function scope. Apart from the function scope, there are other pytest fixture scopes.
Learn how to pass arguments in pytest from cmd line.
Use Builtin Fixtures - pytestconfig.
We can configure Pytest as per our needs. Its quite simple and helpful to customize Pytest in certain cases.
pytest.ini - primary pytest configuration file that allows you to change default behavior.
We can configure Pytest as per our needs. Its quite simple and helpful to customize Pytest in certain cases.
pytest.ini - primary pytest configuration file that allows you to change default behavior.
Lets look into demo on some of the common configurations that we do.
Learn how to do Data Driven Tests with Python Pytest.
Typo at 02:36 min. Read "Were" as "Here". thanks
Do Data Driven Testing using Pytest BDD
Pytest Cheat Sheet, and Code repository.
Hi! Welcome to Python Automation Testing With Pytest!
This course will help you master automation testing with Pytest framework. Pytest is a testing framework which allows us to write test codes using python. We can write code to test anything in any environment, like database, API, and even GUI if you want. It is a simple framework to learn, just like python.
In this course, we will be go through all topics of Python Pytest framework and it assumes that you have minimal prior experience with Python coding.
We will learn everything about Pytest that will help us build a test automation framework easily. We will cover all important aspects of pytest and also how automation is done in real test environment.
Some of topics are highlighted below, we will go thru all of this and more:
Test Naming, and Test discovery
Different types of Assertions
Skipping tests and markers
Parametrized or data driven testing
Fixtures - one of the interesting topics in pytest
Passing cmd line args in pytest
Pytest-BDD - the BDD framework with Pytest
Thank you and see you in this course!!!
Note: This course is solely about Pytest framework, and details in depth about its related topics. How you can use the popular pytest framework within your whole test suite.
This course is designed for all levels of QA test professionals who want to work with Python automation, starting from absolute beginner level to advanced users. Anyone can follow along from top, by understanding each of the lessons and replicating it on their system. No worries if you are in any level of expertise, you can directly go to the session that you want to learn.
Few Comments from Udemy Learners:
"Hi Kumar, I realized that the lectures have been upgraded into a better mode. I came back for revision of pytest and noticed that lecture notes are finally provided. Also, there are also your personal annotation in the videos which are very helpful. Thanks for improvement. Appreciate it."
"Overall the course is good. It gives the understanding of software testing environment other than just programming. Certainly there will be difference in reviews depending on someone's knowledge in Python programming language. I am new in this domain and I know basic Python programming language. So I think if you provide more complex examples also in the course content that would be fine for better exposure and to get the understanding of how deep we need to go or to know where we actually stand in this field. It was good experience with this course. We get good and helpful knowledge in less time."
"hi kumar,your course is goood"