
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
This short lecture welcomes you to the course and gives you a few suggestions on how to take the course. Short, but important!
This short guide tells you how to go about installing Python and PyCharm on a Windows computer.
This short guide tells you how to go about installing Python and PyCharm on a Mac computer.
Welcome to the Python refresher section! In this video we give a brief introduction to this section.
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!
In this video we look at variables in Python—the most fundamental building block of the Python language.
In this video we solve the previous coding exercise. Make sure to attempt the exercise yourself before watching this!
Learn string formatting in python 3.6 and later by using f-strings to embed variables and print dynamic values. Compare this with the format method for reusable templates and longer phrases.
Learn how to get user input in Python with the input function, store it in variables, and print prompts. Convert strings to numbers with int and format results using f-strings.
In this video we look at collections in Python: lists, tuples, and sets. These allow us to store multiple values in the same variable.
Create a list of three numbers totaling 100 and define a singleton-value tuple using a trailing comma. Make set_one intersect set_two to yield five, seven, nine, and twelve.
Learn how booleans drive decisions in Python using comparisons to yield true or false, apply operators ==, !=, >, <, >=, <=, and distinguish is from == lists, tuples, strings.
Explore how if statements use a boolean to drive decisions from user input, such as day_of_week matches Monday. Learn indentation, else/elif branches, and normalizing input with .lower() for case-insensitive matching.
Learn how to use the in keyword for membership tests in Python, checking lists, tuples, sets, and strings with practical examples and user input to return true or false.
Solve flow exercise by using a for loop with if to build an evens list from 1 to 9, using modulus; add elif to print Quit when input is q.
Learn how Python list comprehensions create new lists from existing ones, including doubling numbers and filtering with if; distinguish list identity from equality and how assignment can link lists.
Learn how to use Python dictionaries to map keys to values, add or update entries, and nest dictionaries in lists, while iterating with for loops and items.
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.
Learn how function arguments and parameters work in Python, including positional and keyword arguments, with examples like add and say hello to improve clarity.
Explore how functions return values in Python, using add and divide examples to show None by default, and how return statements control execution and type considerations.
In this video we solve the previous coding exercise. Make sure to attempt the exercise yourself before watching this!
Explore dictionary comprehensions in Python to map usernames to user information using key-value pairs for login tasks.
Learn how object oriented programming in Python uses classes, the init method, and self to create objects with properties like name and grades, and define methods such as average.
Implement classmethod and staticmethod to create a franchised store and to format store details with an integer stock price, using a store class and items.
Explore class inheritance by turning a device into a printer class. Use super() to initialize parent, manage capacity and remaining pages, and implement a print method that checks connection.
Explore how to apply type hints in Python 3.5+ to specify list types and return values, and use typing imports to catch errors with editors and linters.
Learn how imports in Python bring code from other files or folders, using from x import y or import x, and how dunder name and sys.path guide module discovery.
Learn to implement custom error classes in Python by raising a too many pages read error that inherits from value error and use a read method.
Explore python decorators to securely guard functions like get_admin_password by wrapping them with a guard that checks the user's admin access before returning sensitive values.
Learn why mutable default parameters in Python cause shared state across instances and how to fix them by using None and initializing inside the function.
Explore Python fundamentals from variables and methods to higher order functions and decorators, then dive into the unit test library, mocking, patching, and test driven development for reliable software testing.
Install virtualenv, create a dedicated Python 3.x virtual environment for the blog project, and set up a tests package with core files (app, post, blog) in PyCharm.
Learn how to create a simple post class with title and content, and write your first unit test using Python's unittest framework to verify properties and dependency considerations.
Implement a blog data model in Python with title, author, and an empty posts list. Create unit tests and demonstrate running them in PyCharm with run configurations.
Explore test driven development and the __repr__ method by writing tests first, running them, and implementing the simplest code to make them pass for a blog object.
Finish building blog post creation and json serialization with integration tests, organize tests in a dedicated integration package, and compare unit and integration testing techniques, including TDD guidance.
Explore mocking and patching in Python to test a blog app, patch builtins.print with unittest.mock.patch, and verify system tests across an in-memory blog dictionary.
We explore testing a command line app, cover the unit test library, mocking and patching, and introduce test driven development and future web app testing with Flask.
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.
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!
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.
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.
Learn to build your first rest api with Flask, enabling clients to create and retrieve items in a shop, and write unit and integration tests as foundation for upcoming sections.
Examine a barebones rest API built with flask, flask-restful, and flask-sqlalchemy; see how the item resource and endpoints are defined and how to set up testing.
Create an integration test for a REST API item model by saving to and loading from a SQLite database within Flask app context, then deleting the item to verify crud.
Master unit and integration testing for a simple rest api handling items; the next section expands the api with stores to test complex relational database relationships.
Expand the rest api by adding stores and their items, and explore testing, database relationships, and sqlalchemy, including common database testing mistakes.
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.
In this video we look at testing foreign key constraints with Python, which is extremely useful when our applications rely on relational data.
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!
In this video we finish our tests for the Store, and complete the testing of our more complex REST API with Python.
Explore a more complex Rest API, learn SQL alchemy and foreign key constraints and relationships, and anticipate adding user login logic in the next section.
Enable user login by implementing a Flask JWT auth flow with security.py functions authenticate and identity, validating credentials against the user model and authenticating via the authorization header.
Enhance the base test with setup_class to run once per class, and move it to a system tests package containing test_user, test_store, and test_item for API requests.
Learn to build system tests for user registration in a Python API, covering register and login flows, JWT authentication, duplicate user handling, test client and database persistence, with 201 responses.
Use Postman to test a rest api, writing tests for each request and response, and run sequential requests instead of writing tests in Python.
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.
In this video we write our first Postman test. These tests are written in JavaScript, but they are straightforward and very powerful.
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.
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.
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.
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.
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.
Set up a continuous integration pipeline on GitHub to automatically run tests for every change, catching breaking changes and boosting your prestige in the open source community.
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.
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.
In this video we look at a sample Git workflow that we may follow locally.
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.
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.
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.
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.
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!
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.
Set up the project with Git and GitHub, and configure a Travis CI pipeline that runs tests on every push; explore acceptance testing with behavior-driven development and selenium next.
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!
What is acceptance testing? How do we create acceptance tests? Why do we want to do acceptance tests?
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.
In this video we write our first acceptance test step, using Gherkin and Selenium.
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.
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.
In this video we finish writing our first test using Selenium, which contains navigation and checking the current page URL.
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.
In this video we write our first test to check some content of an element!
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.
In this video we create a page in our page model to represent our blog page.
In this video we change all our hard-coded navigation into the specific pages, to make tests more readable and less interdependent.
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!
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.
In this video we look at how we can debug acceptance tests with PyCharm. It's simple, just as you would any other test!
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.
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.
This video concludes this section, and the course!
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, a 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.
Fear not though, after going through this course, you'll be able to take your new testing knowledge and apply it to any project, even non-web projects!
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 course 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 the 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!