Automated Software Testing with Python
4.5 (2,609 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.
17,374 students enrolled

Automated Software Testing with Python

Learn about automated software testing with Python, BDD, Selenium WebDriver, and Postman, focusing on web applications
4.5 (2,609 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.
17,374 students enrolled
Last updated 11/2019
English [Auto], French [Auto], 6 more
  • German [Auto]
  • Indonesian [Auto]
  • Italian [Auto]
  • Polish [Auto]
  • Portuguese [Auto]
  • Spanish [Auto]
Current price: $87.99 Original price: $134.99 Discount: 35% off
2 days left at this price!
30-Day Money-Back Guarantee
This course includes
  • 13.5 hours on-demand video
  • 14 articles
  • 5 downloadable resources
  • 7 coding exercises
  • 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
  • Everything you need to know about automated software testing with Python (and how to enjoy testing, too!)
  • Common pitfalls and best practices when writing automated tests
  • How to write complete system tests using Python and tools like Postman
  • Automate your application testing by setting up a continuous integration pipeline using Travis CI
  • Browser-based acceptance testing using Behave and Selenium WebDriver
Course content
Expand all 141 lectures 13:30:41
+ Welcome!
4 lectures 01:43

This short lecture welcomes you to the course and gives you a few suggestions on how to take the course. Short, but important!

How to take this course

This important lecture contains a self-assessment that you can take at the start of the course. It'll help you gauge how much Python you know, and how much of the Python refresher section you can skip.

A self-assessment

This short guide tells you how to go about installing Python and PyCharm on a Windows computer.

Installing Python and PyCharm on Windows

This short guide tells you how to go about installing Python and PyCharm on a Mac computer.

Installing Python and PyCharm on OS X
+ A Full Python Refresher
49 lectures 05:14:37

Welcome to the Python refresher section! In this video we give a brief introduction to this section.

Preview 01:01

This lecture has a link to all the Python code we'll write in this section. Use it to check your code as you write it, or to refresh your memory!

Access the code for this section here

In this video we look at variables in Python—the most fundamental building block of the Python language.

Preview 08:26
1 question

In this video we solve the previous coding exercise. Make sure to attempt the exercise yourself before watching this!

Solution to coding exercise: Variables
String formatting in Python
Getting user input
Writing our first Python app

In this video we look at collections in Python: lists, tuples, and sets. These allow us to store multiple values in the same variable.

Preview 06:31
Advanced set operations
Lists, tuples, and sets
1 question
Solution to coding exercise: lists, tuples, sets
Booleans in Python
If statements
The 'in' keyword in Python
If statements with the 'in' keyword
Loops in Python
Flow control—loops and ifs
1 question
Solution to coding exercise: flow control
List comprehensions in Python
Destructuring variables

In this video we look at methods in Python, which are names for blocks of code. We can then re-use them over and over again without having to re-write the code again.

Functions in Python
Function arguments and parameters
Default parameter values
Functions returning values
1 question

In this video we solve the previous coding exercise. Make sure to attempt the exercise yourself before watching this!

Solution to coding exercise: Functions
Lambda functions in Python
Dictionary comprehensions
Dictionaries and students
1 question
Solution to coding exercise: dictionaries
Unpacking arguments
Unpacking keyword arguments
Object-Oriented Programming in Python
Magic methods: __str__ and __repr__
Classes and objects
1 question
Solution to coding exercise: classes and objects
@classmethod and @staticmethod
@classmethod and @staticmethod
1 question
Solution to coding exercise: @classmethod and @staticmethod
Class inheritance
Class composition
Type hinting in Python 3.5+
Imports in Python
Relative imports in Python
Errors in Python
Custom error classes
First-class functions
Simple decorators in Python
The 'at' syntax for decorators
Decorating functions with parameters
Decorators with parameters
Mutability in Python
Mutable default parameters (and why they're a bad idea)
Conclusion of this section
+ Your first automated software test
14 lectures 01:43:52
Introduction to this section
Access the code for this section here
Setting up our project
Testing dictionary equivalence
Writing blog tests and PyCharm run configurations
The __repr__ method, and intro to TDD
Integration tests and finishing the blog
Mocking, patching, and system tests
Patching the input method and returning values
Taking our patching further
The last few patches!
The TestCase setUp method
Conclusion of this section
+ Testing a Flask Endpoint
7 lectures 29:20
Introduction to this section
Access the code for this section here

In this video we set up our Flask project so we can start writing System tests for it. We quickly go over setting up the project structure and installing required libraries.

Setting our project up

In this video we create our Flask app and go over its different parts. A quick overview of Flask and how we'll be testing our very first endpoint!

Creating our Flask app

In this video we write our first system test, testing the app from end to end—as if we were a user.

System testing is extremely powerful and useful when testing web applications, but it can be dangerous and slow if overused.

Our first System test

In this video we look at refactoring our System tests so that our code is nicer and easier to maintain. Throughout the rest of the course we'll be writing tests in this refactored fashion.

Refactoring our System Tests
Conclusion of this section
+ REST API Testing, Part I
7 lectures 44:26
Introduction to this section
Access the code for this section here
A look at a REST API with Flask
Setting up our generic BaseTest
Integration testing a REST API
Conclusion of this section
+ REST API Testing, Part II
7 lectures 38:05
Introduction to this section
Access the code for this section here

In this video we look at our more complex REST API with Flask, and explain how it has evolved since the last section. We add Stores and relationships between our various models with SQLAlchemy.

Setting up our project

In this video we look at testing foreign key constraints with Python, which is extremely useful when our applications rely on relational data.

Testing foreign key constraints with Python

In this video we look at unit testing a more complex REST API, and how the SQLAlchemy mappers work in a Python application. Avoid some common mistakes!

Unit testing models and SQLAlchemy mappers

In this video we finish our tests for the Store, and complete the testing of our more complex REST API with Python.

Finishing our Store tests
Conclusion of this section
+ System testing a REST API
11 lectures 01:09:03
Introduction to this section
Access the code for this section here
Setting project up and creating User model
Allowing users to log in
Writing our User tests
The setUpClass method in the BaseTest
Testing user registration
Finalising user System tests
Writing Store System tests
Writing our Item System tests and testing authentication
Conclusion of this section
+ System testing with Postman and Newman
10 lectures 45:18
Introduction to this section
Access the code and Postman files here

In this video we look at Postman, a great tool we can use to send requests to our API and make some checks and tests on the response.

Introduction to Postman

In this video we write our first Postman test. These tests are written in JavaScript, but they are straightforward and very powerful.

Our first Posman tests

In this video we look at the power of environment variables in Postman to share data across requests and responses. Setting and clearing environment variables programmatically will make our tests much more capable.

Setting and clearing environment variables in Postman

In this video we look at running a sequence of tests in Postman. This lets us define a set of requests that make up a User journey, and run the tests pretending to be the user themselves.

Running a test folder in Postman

In this video we look at advanced PyCharm run configurations and plugins, which are going to let us run our Postman tests directly from PyCharm.

Advanced PyCharm run configurations

In this video we look at installing Node and Newman on OS X. We'll need this to run our tests through the console (and thus through PyCharm). Instructions are also available for Windows on a lecture attachment.

Installing Node and Newman

In this video we look at running multiple PyCharm run configurations one after another. Since our tests depend on our app being running, we must be able to run the app first and the tests after—in one click.

Multirun in PyCharm—Running app and tests together
Conclusion of this section
+ Continuous Integration with Travis CI
12 lectures 43:14
Introduction to this section
The code for this section

In this video we look at installing Git in both OS X and Windows. Git is extremely powerful for teamwork, error control, and keeping a history of what's changed in a project.

Installing Git

In this video we look at what a Git repository is, exactly. This video guides you through the different layers of a repository and what each one does.

What is a Git repository?

In this video we look at a sample Git workflow that we may follow locally.

A local Git workflow

In this video we look at GitHub, one of the popular repository-hosting sites. We also look at remote repositories, which are hosted in GitHub.

GitHub and remote repositories

In this video we look at adding our Flask REST API project to GitHub, so that we can then run our tests on the remote repository.

Adding our project to GitHub

In this video we look at our Continuous Integration pipeline, Travis CI. It's going to look at our remote repository whenever a commit is pushed, and run our tests on the latest code available.

What is Travis CI?

In this video we look at how we can add our GitHub repository to Travis so that it knows about it and can start looking at the code.

Adding our repository to Travis

In this video we look at the Travis configuration file—we need it so Travis knows what language to run, and how to run the tests. It's really quite powerful!

The Travis config file and running tests

In this video we look at adding our "Tests Passing" badge to the Readme of our repository. This not only gives readers some information about our project, but also some software engineering kudos by making the fact that we have tests visible.

Adding our test badge to the Readme
Conclusion of this section
+ Acceptance testing and browser automation with Selenium
19 lectures 02:00:11

Welcome to this section on acceptance testing! Acceptance testing is a very exciting form of testing that encourages customers to write the tests.

Using Behavior-Driven Development (BDD), we can easily model our tests after what customers say. Learn all about it in this section!

Introduction to this section

What is acceptance testing? How do we create acceptance tests? Why do we want to do acceptance tests?

What is acceptance testing?

In this section I provide a simple website that we'll test using acceptance testing methods and BDD. This lecture is a guide over what the website does and how it works.

Introduction to our project

In this video we write our first acceptance test step, using Gherkin and Selenium.

Our first acceptance test step

This video quickly walks you through getting the Chrome webdriver (remember to update your version of Chrome!), and how we can use it from Selenium.

Getting the Chrome webdriver

Make sure everything works—if Selenium isn't running, your tests won't run! This video walks us through any fixes we might have to do.

Verifying everything works

In this video we finish writing our first test using Selenium, which contains navigation and checking the current page URL.

Finishing our first test

In this video we learn about the regular expression matcher in the behave library, which allows us to pass in arguments through the Gherkin steps.

Re-using steps with the regular expression matcher

In this video we write our first test to check some content of an element!

Our first content test

This is arguably the most important video—structuring your acceptance tests so that you and your teammates can work efficiently, by splitting them into separate locators and a page model which represents the pages in your application.

Page locators and models

In this video we create a page in our page model to represent our blog page.

The blog page

In this video we change all our hard-coded navigation into the specific pages, to make tests more readable and less interdependent.

Using pages in navigation

Just a word of warning in this video! You will not have too many acceptance tests, so don't worry about making everything as efficient and generalised as possible. Often, that will result in poor readability and maintainability.

It's okay to have a small amount of duplication in the pursuit of better maintainability in the long term!

Don't over-generalise tests!

Often, acceptance tests will be slow—be it due to internet speed or JavaScript doing things. Often these tests will include waits, in order to give time for things to load. It's a very bad practice to have explicit waits (such as '5 seconds').

Instead, this video covers implicit waits: waiting for something to happen. As soon as it happens, the test moves on—not wasting any precious time.

Waits and timeouts with Selenium

In this video we look at how we can debug acceptance tests with PyCharm. It's simple, just as you would any other test!

Debugging acceptance tests in PyCharm

In this video we look into our final complex scenario, which will have our Chrome webdriver filling in a form and checking that content is created accordingly.

Our final complex scenario

Filling in forms with Selenium is really simple, especially when we've structured our page using locators and a page model. Learn how to in this video.

Filling in forms with Selenium
Access the final code of this section here

This video concludes this section, and the course!

Conclusion of this section
  • We'll give you a complete Python refresher, but some previous knowledge of programming will be helpful
  • Some knowledge of how web applications work
  • Understanding of REST APIs will be helpful, but not required

Welcome to the most comprehensive course on Automated Software Testing with Python on Udemy.

Testing automation doesn't have to be painful. Software testing is an essential skill for any developer, and I'm here to help you truly understand all types of test automation with Python.

I'm Jose, software engineer and founder of Teclado. The focus of this course is on testing for the web—we'll be working with REST APIs and web applications, and technologies such as unittest, Postman, and Selenium WebDriver.

What will you work with?

This course is jam packed with all the latest technologies for you to use professionally and in personal projects:

  • The unittest library, Python's standard automated software testing library;
  • Mocking and patching, two essential tools to reduce dependencies when testing;
  • unit, integration, system, and acceptance testing—all types of testing to have you fully covered;
  • Postman for easy collaboration and testing while developing;
  • Selenium WebDriver for automated browser tests;
  • Git and Travis for continuous integration of your project.

Fundamental Software Testing Skills

We will cover every fundamental software testing skill that you need to know in order to get a job testing or to apply these skills in your existing projects.

From things like mocking and patching using the unittest library, which reduce dependencies and turn complex tests to simple ones; to looking at all types of testing: simple unit tests to large system tests and even customer acceptance tests.

The Testing Pyramid

The Testing Pyramid says you should have a lot of unit tests, slightly fewer integration tests, even fewer system tests, and as few acceptance tests as possible.

Throughout the program we work on this concept, making sure that we have full coverage of every component of our system with unit tests. Then we test the dependencies using integration tests. Finally, we cover the entire system and its assumptions using system tests. Of course, we'll also look at what acceptance testing is, how we come up with acceptance tests, and some of the best ways to write acceptance tests for a web application using Behavior-Driven Development and Selenium WebDriver.

Automated Browser Testing with Selenium WebDriver

Selenium WebDriver is extremely powerful, particularly when coupled with the efficient and tried-and-tested approach recommended in this course. We'll design our acceptance tests professionally—just the way you'd do at a software testing job. We'll use page models, locators, and step definitions to structure the automated tests in a reusable way. The customers will be able to come up with acceptance tests that you can easily translate to code.

We'll also learn about implicit and explicit waits with Selenium WebDriver and Python, a key concept to speed up runtime of your acceptance tests.

Continuous Integration

We also cover how you can take automated testing much further in your projects.

By implementing a Continuous Integration pipeline that runs your tests whenever you make any changes, you'll have much higher quality in your projects and not let any pesky bugs pass you by. We'll look at putting our projects in GitHub and liking the CI pipeline with them.

I'm really excited to guide you through this course!

Join me in this automated testing journey. I'll see you on the inside!

Who this course is for:
  • Advanced students who want to learn about testing their Python applications to build more complete solutions
  • Professionals wanting to learn more about automated software testing in their workplace
  • Automated software testers and software developers