Backend Api Testing With Python

Learn to build framework for API automation testing (backend testing) using Python and PyTest, SQL, Reports, Docker ...

Last updated 2022-01-10 | 4.6

- How to write API automation (backend automation) using Python 3
- How to validate API response
- How to build automation framework

What you'll learn

How to write API automation (backend automation) using Python 3
How to validate API response
How to build automation framework
BONUS: SQL Crash Course
How to validate database
How to generate reports for your tests (pytest-html
Allure
jUnit)
How to create a real eCommerce WordPress site locally
How to run tests in Docker container
How to use PyTest (most popular unit testing framework)

* Requirements

* Have basic knowledge of Python programming language
* Have basic knowledge of software testing
* Have sudo/admin access to your laptop to be able to install software

Description

Course Description

Learn how to use Python to test the back-end of web services or APIs. We use industry standard real eCommerce RESTful API to practice testing using Python programming language.

We will build a framework using one of the most popular testing tools PyTest. The framework we will build will be extendable and scalable to be able to include frontend (Selenium WebDriver) testing.

The skills learned here are used in any Web Serivces testing.


BONUS: SQL Crash Course

You will learn how to use SQL to read and write to/from databases. We will use MySQL for our main test site so we will use the same database to learn SQL. SQL (sequel) is critical skill for any test engineer (manual or automation needs to know basic SQL).

The crash course in SQL is short and precise. Topics only directly related to automation are covered. Great addition to your resume and interview process.


Critical addition to your resume

If you are getting into the QA world or you are looking to advance your career, having API testing skill will accelerate your success. Python is one of the most popular languages to use in software testing, and knowing how to use it for API/Backend testing will expand your pool of possibilities.

In addition to using Python for API/Backend testing, the tools we will use are great addition to your resume. We will be using industry standard tools that can be applied to several tasks beyond API testing.

After completion of this course you will be able to go through interview as if you have API testing experience. You will also have plenty of APIs to test and practice.


Content and Overview

In this course we will spend some time creating an eCommerce application on our local machine. We will install a package that includes web server and database. Using this package we will install WordPress and install necessary plugins to make it an eCommerce application. The eCommerce application gives us all the APIs we will test.

We have access to the database so we will test API data against the database. We will create a efficiently structured test framework and learn how to use Python to perform our verification.

We will also learn how to use a Python test runner tool "pytest" see why test runner tools are critical for automation testing.


What am I going to get from this course?

  • 35 + lectures (continuously adding more examples)

  • Plenty of APIs (endpoints) for you to practice with      beyond this class

  • Enough material and examples to be able to create a      project and maintain a GitHub repo

  • Industry standard tools to add to your resume.

    • Like

      • MySQL Workbench

      • AMPPS (package with Apache, MySQL, PHP, ....)

      • WordPress

      • WooCommerce

Who this course is for:

  • Anyone looking to learn automation Backend/API testing
  • Anyone that already know basic Python and want to learn Backend/API testing
  • Anyone looking to gain experience automating the backend test for real eCommerce site
  • Anyone looking to learn to setup their own API locally and practice testing

Course content

14 sections • 102 lectures

Welcome To The Course Preview 03:04

Table Of Content Preview 04:04

Preview of End Result Preview 05:40

About The Test Site and Ecommerce API Preview 03:15

Intro to Installation and Setup Section Preview 03:48

Installing Python On Mac Preview 04:17

Installing Python On Windows Preview 09:21

How to Use Virtual Environment Preview 10:10

Create Virtual Environment For The Course Preview 06:12

Install IDE (PyCharm) Preview 07:05

PyCharm Project & Virtual Environment Preview 05:56

Options To Run WordPress Preview 07:50

Running WordPress with MAMP Preview 17:02

Install "Local" For WordPress Preview 02:23

Create A Site Preview 03:58

Using "localhost" instead of Site Name Preview 03:33

Install AMPPS & WordPress Preview 05:57

Install Plugin "WooCommerce" Preview 04:51

Adding Sample Products to the Site Preview 03:37

Setup and Verify API with Postman and Python Preview 13:40

Install MySQL WorkBench & Connect to Database Preview 08:10

Introduction to PyTest Preview 11:40

Selecting Tests By Markers (Tags) Preview 12:34

Setup & Teardown (fixtures) Preview 09:12

PyTest HTML Report Preview 05:45

How To Use The Provided Code Preview 16:58

Project Structure Overview Preview 10:56

TCID-29 - Discussion - "create a customer" endpoint Preview 09:39

TCID-29 - Design Test Code Template Preview 11:39

Helper - Email & Password Generator (TCID-29) Preview 11:59

Helper - Crete Customer (TCID-29) Preview 12:07

Helper - 'POST' request (TCID-29) Preview 14:43

Authenticate our API call Preview 10:23

Helper - Credentials Preview 17:21

TCID-29 Verify 'Create Customer' API Response Preview 10:01

Setting Environment Variables Preview 05:43

Customers DAO Preview 04:41

Helper - Database Connect & SQL Preview 18:26

TCID-29 Verify Database Preview 06:52

TCID-30 - Discussion - List All Customers Endpoint Preview 01:20

TCID-30 - List All Customers (GET Call) Preview 10:41

TCID-47 - Create Customer Existing Email (negative test) Preview 19:27

Run All Customers Test Cases Preview 03:32

Assignment - Automate TCID-24 (Get All Products) Preview 01:32

TCID-24 Get All Products - Implementation Preview 09:14

TCID-25 Get Product By ID Preview 16:22

TCID-26 Create Simple Product Preview 15:56

TCID-51-1 List Product With Filter "after" Preview 18:58

TCID-51-2 List Product With Filter "after" - db verification Preview 14:15

TCID-51-3 List Product With Filter "after" - more pages Preview 08:54

WooCommerce Python Library Intro Preview 15:07

TCID-48-1 Place Guest Order - Discussion Preview 02:29

TCID-48-2 Place Guest Order - Read Payload From File Preview 15:25

TCID-48-3 Place Guest Order - Make The Call Preview 11:41

TCID-48-4 Place Guest Order -Validate Response Preview 05:35

TCID-48-5 Place Guest Order -Validate db Preview 18:02

TCID-49 Place Order With New Customer Preview 17:00

Setup Example with TCID-49 Preview 11:03

Use Configs for Database Connections Preview 19:47

TCID-55-1 Update Order Status - Cancelled Preview 16:29

TCID-55-2 Update Order Status - Cancelled Preview 06:35

TCID-55,56,57 Parametrization Preview 08:07

TCID-58 Update Order Status - Invalid Status Preview 10:17

TCID-59 Update Order - "customer_note" Preview 06:49

Exercise TCID-61: Verify update 'regular_price' updates the 'price' field Preview 00:24

Exercise TCID-63: Verify update 'sale_price > 0' will set field 'on_sale'=True Preview 00:31

Exercise TCID-64: Verify update 'sale_price=" "' will set field 'on_sale'=False Preview 00:30

Exercise TCID-65: Verify update 'sale_price' updates the 'sale_price' field Preview 00:24

Exercise TCID-60: Order with 50% off coupon should reduce total by 50% Preview 00:21

Exercise TCID-37: Create a new coupon with 'discount_type=percent' Preview 00:15

Exercise TCID-38: Create a new coupon with 'discount_type=fixed_cart' Preview 00:18

Exercise TCID-39: Create a new coupon with 'discount_type=fixed_product' Preview 00:18

Exercise TCID-40: Create a new coupon with 'discount_type=' Preview 00:17

Docker Section Introduction Preview 01:26

Create Dockerfile & Build Image Preview 13:17

Start Container and Try Test Run - unsuccessful Preview 08:42

Connect to Database From Container Preview 06:17

Use Docker Volumes To Avoid Image Rebuild Preview 13:23

Make API Cal from Container Preview 08:13

Run Tests From Outside Container Preview 03:21

Wrapper Script To Run Tests In Container Preview 11:54

Color Output From Docker Run Preview 01:34

Using Debugger (pdb) With Docker Preview 02:25

Timestamp The Report Preview 04:22

Docker Section Summary Preview 02:46

Introduction to the SQL Crash Course Preview 02:49

Introduction to SQL Preview 08:15

Setup Database and Data Preview 12:47

SQL SELECT Query (Reading Data) Preview 11:50

SQL SELECT Query Continued Preview 11:25

SQL SELECT Query Continued 2 Preview 08:40

SQL IN Clause Preview 07:31

SQL SELECT Sub-Query Preview 10:48

SQL LIKE Clause Preview 07:30

Intro to SQL JOIN Preview 08:40

SQL JOIN Preview 08:52

SQL LEFT JOIN Preview 09:13

SQL Special Functions Preview 14:11

SQL INSERT INTO Preview 12:19

SQL CREATE TABLE Preview 06:46

SQL DROP and TRUNCATE Preview 04:16

SQL Crash Course Conclusion Preview 02:16