Automated Software Testing with Python
4.6 (2,465 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.
16,560 students enrolled

Automated Software Testing with Python

Learn about automated software testing with Python, BDD, Selenium WebDriver, and Postman, focusing on web applications
4.6 (2,465 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.
16,560 students enrolled
Last updated 11/2019
English
English [Auto-generated], French [Auto-generated], 6 more
  • German [Auto-generated]
  • Indonesian [Auto-generated]
  • Italian [Auto-generated]
  • Polish [Auto-generated]
  • Portuguese [Auto-generated]
  • Spanish [Auto-generated]
Current price: $93.99 Original price: $134.99 Discount: 30% off
5 hours 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
00:45

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
00:14

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

Installing Python and PyCharm on Windows
00:24

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

Installing Python and PyCharm on OS X
00:20
+ 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
00:24

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

Preview 08:26
Variables
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
02:00
String formatting in Python
06:26
Getting user input
05:16
Writing our first Python app
03:19

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
04:39
Lists, tuples, and sets
1 question
Solution to coding exercise: lists, tuples, sets
04:40
Booleans in Python
04:59
If statements
08:17
The 'in' keyword in Python
02:02
If statements with the 'in' keyword
08:18
Loops in Python
11:07
Flow control—loops and ifs
1 question
Solution to coding exercise: flow control
03:08
List comprehensions in Python
07:24
Dictionaries
08:31
Destructuring variables
08:28

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
10:41
Function arguments and parameters
07:40
Default parameter values
03:54
Functions returning values
07:19
Functions
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
02:30
Lambda functions in Python
07:52
Dictionary comprehensions
04:01
Dictionaries and students
1 question
Solution to coding exercise: dictionaries
06:16
Unpacking arguments
10:24
Unpacking keyword arguments
08:44
Object-Oriented Programming in Python
15:52
Magic methods: __str__ and __repr__
06:25
Classes and objects
1 question
Solution to coding exercise: classes and objects
05:04
@classmethod and @staticmethod
14:03
@classmethod and @staticmethod
1 question
Solution to coding exercise: @classmethod and @staticmethod
05:54
Class inheritance
08:32
Class composition
06:08
Type hinting in Python 3.5+
05:08
Imports in Python
09:33
Relative imports in Python
08:52
Errors in Python
12:47
Custom error classes
05:04
First-class functions
07:52
Simple decorators in Python
07:12
The 'at' syntax for decorators
03:33
Decorating functions with parameters
02:24
Decorators with parameters
04:50
Mutability in Python
06:03
Mutable default parameters (and why they're a bad idea)
04:27
Conclusion of this section
00:37
+ Your first automated software test
14 lectures 01:43:52
Introduction to this section
00:24
Access the code for this section here
00:25
Setting up our project
06:42
Testing dictionary equivalence
05:25
Writing blog tests and PyCharm run configurations
06:43
The __repr__ method, and intro to TDD
08:48
Integration tests and finishing the blog
11:57
Mocking, patching, and system tests
16:37
Patching the input method and returning values
07:29
Taking our patching further
16:03
The last few patches!
07:07
The TestCase setUp method
04:36
Conclusion of this section
00:27
+ Testing a Flask Endpoint
7 lectures 29:20
Introduction to this section
00:26
Access the code for this section here
00:25

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
04:38

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
06:50

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
09:56

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
06:32
Conclusion of this section
00:33
+ REST API Testing, Part I
7 lectures 44:26
Introduction to this section
00:35
Access the code for this section here
00:30
A look at a REST API with Flask
18:18
Setting up our generic BaseTest
09:36
Integration testing a REST API
06:47
Conclusion of this section
00:25
+ REST API Testing, Part II
7 lectures 38:05
Introduction to this section
00:20
Access the code for this section here
00:30

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
08:45

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
05:25

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
11:03

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
11:38
Conclusion of this section
00:24
+ System testing a REST API
11 lectures 01:09:03
Introduction to this section
00:28
Access the code for this section here
00:26
Setting project up and creating User model
03:58
Allowing users to log in
04:10
Writing our User tests
04:14
The setUpClass method in the BaseTest
04:59
Testing user registration
06:41
Finalising user System tests
07:31
Writing Store System tests
13:35
Writing our Item System tests and testing authentication
22:35
Conclusion of this section
00:26
+ System testing with Postman and Newman
10 lectures 45:18
Introduction to this section
00:40
Access the code and Postman files here
00:22

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
09:01

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
05:50

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
07:04

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
07:53

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
06:08

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
04:43

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
03:01
Conclusion of this section
00:36
+ Continuous Integration with Travis CI
12 lectures 43:14
Introduction to this section
00:38
The code for this section
00:13

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
04:12

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?
05:27

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

A local Git workflow
04:31

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
05:17

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
04:51

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?
02:29

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
01:38

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
10:33

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
02:47
Conclusion of this section
00:38
+ 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
00:40

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

What is acceptance testing?
05:08

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
03:10

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

Our first acceptance test step
10:46

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
03:38

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
05:44

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

Finishing our first test
14:51

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
04:00

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

Our first content test
09:18

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
18:36

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

The blog page
07:30

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
06:45

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!
02:25

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
07:33

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
03:32

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
02:46

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
13:01
Access the final code of this section here
00:07

This video concludes this section, and the course!

Conclusion of this section
00:41
Requirements
  • 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
Description

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