Elegant Automation Frameworks with Python and Pytest
4.3 (875 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
3,801 students enrolled

Elegant Automation Frameworks with Python and Pytest

Fast, scalable, professional-grade framework design
4.3 (875 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
3,801 students enrolled
Created by Brandon Blair
Last updated 6/2020
English [Auto]
Current price: $104.99 Original price: $149.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 6 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Build high-performing, reliable automated test suites with actionable reporting
Course content
Expand all 15 lectures 05:50:46
+ Setting Up Your Environment
3 lectures 27:39

Let's set up Python 3 on your Windows machine, and ensure we're working with the same tools so you don't run into unnecessary hardship. NOTE: I mention PyCharm in this video, but we will be using VSCode for this course! If you have an IDE you are comfortable with, that is fine too.

Setup Python 3 (Windows)

In order to avoid problems, it's best if you and I are working with the same tools. I want automating to be a fun and rewarding experience, not a frustrating one!

Setting up Your Virtual Environment (Windows)

For those of you working on Mac OS or linux, I've got you covered! We go over setting up Python 3 and your virtual environment.

Setting up Python 3 and the Virtual Environment (Mac OS / Linux)
+ The Pytest Framework
8 lectures 03:36:26

There are a lot of reasons I build most of my frameworks around Pytest, but two of the most important are that it is simple to use, and very quick to setup! In this session we will set up a simple framework around some dummy tests and explain the pytest.ini file. To view the "Setting up your Virtual Environment" video, click on the link in resources, and click "Preview this Course" where you see the preview video - this will give you access to all the free videos from my Browser Automation course, including virtual environment setup.

Preview 20:34

We may not want to run all the tests all the time. It would also be nice if we could organize our tests so that they weren't all crammed into a single folder. In this session we will discuss why test searching is so amazing, and why you should never run a test case file ever again.

Test Searching

Let's go over the core principles of test search...

Test Search
7 questions

Fixtures are one of the most powerful tools Pytest offers. I have personally seen a fixture-based approach eliminate 80% of all code from a test suite by eliminating duplicated and copy-paste setup/teardown code. If you need to change or remove something, you do it once and you're done. Think of what you could do with all that time not spent maintaining thousands of lines of duplicated code.

Save Time and Code with Test Fixtures

It's important to demonstrate understanding of the foundations of fixtures and some of the use cases where they are very useful

Fixtures Quiz
6 questions

A good automation framework provides on-demand, actionable information about the status of the product. Today we learn how to generate HTML reports for quick, readable summaries, but more importantly how to generate XML reports that can be read by many analysis tools.

I will demonstrate a quick reporting recipe using the open source Continuous Integration tool "Jenkins", since many students may work on teams that use Jenkins. The concept is transferable to many other tools that read XML test reports.

Reporting Test Results and Tracking Test History

A good test framework is customizable, and we shouldn't be changing test code to accomodate changes. We will learn how to pass data into your test run using the command line, and write a self-building configuration file that allows testing in different environments without changing any code.

Customizing Test Runs with the Command Line and Configuration Files

How do we skip tests without forgetting we ever wrote them? How do we handle tests that are expected to fail? We cover both of these solutions in today's lecture.

Handling Skips and Expected Failures

Too often I see copy and pasted test cases in cases where we want to run the same test against multiple sets of data. In this lecture we learn a recipe for testing multiple browsers without writing additional tests, and how to perform Data-driven testing using the contents of a JSON file.

Cross-Browser and Data-driven testing with parametrize

Learn the difference between parallelism and concurrency, and how we can leverage parallel testing to slash run-times on our test suites.

Fast Testing with Pytest-xdist, and Parallel vs Concurrent
+ Writing Great Tests
3 lectures 01:23:47

Unit Tests are performed at the lowest levels of the code, often at the level of validating the expected behavior of a single function. We will learn how to write valuable, well-scoped unit tests to expose bugs before we push our changes to the repository.

Writing Unit Tests (White Box Testing)

In order to set up our unit tests for primetime, it's important to separate our testing harness and cases from the library we are testing. We will use a tool called Tox to make this process fast, fluid, and repeatable.

Running Unit Tests with Tox

Functional Tests can be at any level of the product, though for our purposes I use the term to mean any testing which occurs external to the product's code. When testing something from the "outside", it's important that we structure our tests and framework so that our intent is clear, and so that the tests are maintainable by other people.

Writing Functional Tests (Black/Grey Box Testing)
  • You should have a basic understanding of the Python programming language

Give your team on-demand, actionable insights into the status of your product with a fast, scalable test automation framework written in Python using the Pytest toolkit. Learn how to eliminate boilerplate setup and teardown code, run multiple tests at the same time, and track the history of your test runs to identify slow or problematic tests.

Learn lessons collected over years of professional automation in just a few hours.

  • Never manage test suites again - let them manage themselves
  • Achieve blazing fast test runs with parallel execution
  • More coverage with less code
  • Industry-ready test structure

A Bulletproof approach to automation fundamentals  Python is one of the most popular languages in the world, and the demand for it is only increasing. Pytest is one of the most actively maintained testing frameworks in the industry, and provides an incredible set of tools for faster, less-stressful testing.

Automated testing is one of the most in-demand fields in today's tech market, but there is very little guidance on how the engineer can move from writing tests to building a robust test architecture. Reliable test frameworks save compounding amounts of time and money, improve trust between testers and developers, and make for happier testers. Happy testers are more productive, more effective, and tend to grow within the organization. Everyone wins.

The most widely circulated videos on these topics speak only to the technologies themselves, and do not offer viable implementation guidance or valuable industry practices. I have made these valuable practices the focus of this course.

Content and Overview Suitable for those comfortable with basic Python and Object-Oriented Programming concepts, these lectures build a rock-solid foundation of skills required to automate at a professional level.

Beginning with a brief introduction and a step-by-step setup of Pytest, this course allows you to watch as I walk you through each action, explaining as we go.

We will discuss what makes a good framework, and maybe more importantly, what makes a bad one. We will learn how to use test searching to avoid cumbersome test suites, and how fixtures can eliminate up to 80% of the code in a bloated codebase.

Students completing the course will have the knowledge to build high-performance, well-organized, scalable test frameworks at the professional level.

Equipped with code samples, short quizzes, and info-rich videos, you’ll have no trouble following along with the concepts, and I am always available for questions.

Finally, automating is a blast, and I wish more people did it. Let me rephrase that - I wish more people did it, and did it well! We need more people like you executing effective, high-value automation solutions, so let's get started on this journey together!

Who this course is for:
  • Anyone who wants to build or improve an automated testing framework