Automated Software Testing with Python

Video description

Learn about automated software testing with Python, BDD, Selenium WebDriver, and Postman, focusing on web applications

About This Video

  • Learn automated software testing with Python
  • Learn to write complete system tests using Python and tools such as Postman

In Detail

Welcome to the most comprehensive course on automated software testing with Python. Software testing is an essential skill for any developer, and this course will help you truly understand all types of test automation with Python.

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-ranging from operations such as mocking and patching using the unit test library (to reduce dependencies and turn complex tests into simple ones) to looking at all types of testing: simple unit tests to large system tests and even customer acceptance tests.

Throughout the course we work on the Testing Pyramid concept, making sure that we have full coverage of every system component with unit tests. Then we test dependencies using integration tests. Finally, we cover the entire system using system tests. Of course, we 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. We also learn about implicit and explicit waits with Selenium WebDriver and Python, a key concept used to speed up the runtime of your acceptance tests. By implementing a Continuous Integration pipeline that runs your tests whenever you make any changes, you'll have much higher project quality so that you don't miss any annoying bugs. We'll look at putting our projects into GitHub and linking with them.

Who this book is for

This course is designed for students who want to test their Python applications in order to build more complete solutions, professionals keen to learn more about automated software testing in their workplace, automated software testers, and software developers.

Publisher resources

Download Example Code

Table of contents

  1. Chapter 1 : Welcome
    1. Welcome to the course
  2. Chapter 2 : A Full Python Refresher
    1. Variables in Python
    2. String formatting in Python
    3. Getting user input
    4. Writing our first Python app
    5. Lists, tuples, and sets
    6. Advanced set operations
    7. Booleans in Python
    8. If statements
    9. The "in" keyword in Python
    10. If statements with the "in" keyword
    11. Loops in Python
    12. List comprehensions in Python
    13. Dictionaries
    14. Destructuring variables
    15. Functions in Python
    16. Function arguments and parameters
    17. Default parameter values
    18. Functions returning values
    19. Lambda functions in Python
    20. Dictionary comprehensions
    21. Unpacking arguments
    22. Unpacking keyword arguments
    23. Object-Oriented Programming in Python
    24. Magic methods: __str__ and __repr__
    25. @classmethod and @staticmethod
    26. Class inheritance
    27. Class composition
    28. Type hinting in Python 3.5+
    29. Imports in Python
    30. Relative imports in Python
    31. Errors in Python
    32. Custom error classes
    33. First-class functions
    34. Simple decorators in Python
    35. The "at" syntax for decorators
    36. Decorating functions with parameters
    37. Decorators with parameters
    38. Mutability in Python
    39. Mutable default parameters (and why they're a bad idea)
  3. Chapter 3 : Your first automated software test
    1. Introduction to this section
    2. Setting up our project
    3. Writing our first test
    4. Testing dictionary equivalence
    5. Writing blog tests and PyCharm run configurations
    6. The __repr__ method, and intro to TDD
    7. Integration tests and finishing the blog
    8. Mocking, patching, and system tests
    9. Patching the input method and returning values
    10. Taking our patching further
    11. The last few patches!
    12. The TestCase setUp method
    13. Conclusion of this section
  4. Chapter 4 : Testing a Flask Endpoint
    1. Introduction to this section
    2. Setting our project up
    3. Creating our Flask app
    4. Our first System test
    5. Refactoring our System Tests
    6. Conclusion of this section
  5. Chapter 5 : REST API Testing, Part I
    1. Introduction to this section
    2. A look at a REST API with Flask
    3. Unit testing a REST API
    4. Setting up our generic BaseTest
    5. Integration testing a REST API
    6. Conclusion of this section
  6. Chapter 6 : REST API Testing, Part II
    1. Introduction to this section
    2. Setting up our project
    3. Testing foreign key constraints with Python
    4. Unit testing models and SQLAlchemy mappers
    5. Finishing our Store tests
    6. Conclusion of this section
  7. Chapter 7 : System testing a REST API
    1. Introduction to this section
    2. Setting project up and creating User model
    3. Allowing users to log in
    4. Writing our User tests
    5. The setUpClass method in the BaseTest
    6. Testing user registration
    7. Finalising user System tests
    8. Writing Store System tests
    9. Writing our Item System tests and testing authentication
    10. Conclusion of this section
  8. Chapter 8 : System testing with Postman and Newman
    1. Introduction to this section
    2. Introduction to Postman
    3. Our first Posman tests
    4. Setting and clearing environment variables in Postman
    5. Running a test folder in Postman
    6. Advanced PyCharm run configurations
    7. Installing Node and Newman
    8. Multirun in PyCharm—Running app and tests together
    9. Conclusion of this section
  9. Chapter 9 : Continuous Integration with Travis CI
    1. Introduction to this section
    2. Installing Git
    3. What is a Git repository?
    4. A local Git workflow
    5. GitHub and remote repositories
    6. Adding our project to GitHub
    7. What is Travis CI?
    8. Adding our repository to Travis
    9. The Travis config file and running tests
    10. Adding our test badge to the Readme
    11. Conclusion of this section
  10. Chapter 10 : Acceptance testing and browser automation with Selenium
    1. Introduction to this section
    2. What is acceptance testing?
    3. Introduction to our project
    4. Our first acceptance test step
    5. Getting the Chrome webdriver
    6. Verifying everything works
    7. Finishing our first test
    8. Re-using steps with the regular expression matcher
    9. Our first content test
    10. Page locators and models
    11. The blog page
    12. Using pages in navigation
    13. Don't over-generalise tests!
    14. Waits and timeouts with Selenium
    15. Debugging acceptance tests in PyCharm
    16. Our final complex scenario
    17. Filling in forms with Selenium
    18. Conclusion of this section

Product information

  • Title: Automated Software Testing with Python
  • Author(s): Jose Salvatierra Fuentes
  • Release date: September 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781839214592