
Welcome to Elegant API Automation!
Today we will address two common questions: What is an API? Why is it valuable to know how to use them?
Let's look at the most common HTTP Request methods, and how they are constructed.
To avoid confusion and frustration, let's make sure we're all using the same working environment. This course will use Python 3.8 and manage virtual environments automatically using the Pipenv tool. We will also be downloading the test application I have written for you to test against, "CRUD-test".
It's important to be familiar with the tools we will be using: in this lecture we'll learn about our IDE, Visual Studio Code.
Now that we are ready to write API requests, we will need the "requests" library in Python to get our first automation completed!
Now that we understand what HTTP requests do, it's time to try an HTTP request of our own using Python.
Clients need a way to describe the request they are sending to the server, and Headers provide this functionality. We will discuss the different types of Request and Response headers.
Servers need a way to maintain sessions with clients over long periods of time. When you return to a favorite website a few hours later and there is no need to log in again, this is often because your browser has stored cookies for that website.
How do servers know what types of devices are contacting them via HTTP Requests? The answer is a special Header called the "User Agent." It is important to know what User Agents the web service supports, and how to pass the correct one when testing.
API functionality can vary greatly across products, so it is important to be ready to handle the HTTP methods you are most likely to encounter in the wild.
Now it is time to get a look at the application we will be testing to hone our backend/API automation skills!
This video is a reference for running the test application - if you forget the steps, this will get you up and running in a few minutes.
To test our application we will need to input some data into it. At the same time we will look at the requests being made by the browser, and begin to learn how we might use these requests to automate this process.
Using the Test Application we have set up, we can practice writing HTTP requests using the different methods supported by the requests library.
In order to write elegant automated API tests, we need to leverage a strong testing framework. In this course we will use Pytest, which is very user-friendly and powerful right out-of-the-box.
We will write our first test case and learn how Pytest uses test-searching to run our cases automatically.
In order to write concise, readable, well-scoped test cases, it's critical that we learn good test setup and teardown practices. Fixtures are an incredibly powerful tool that make Pytest very comfortable to use.
Let's perform our first API automated test! We'll make sure we can reach the landing page of the application as we get used to the new tools in our toolbelt.
Now that we have a working session object, let's use it to log into the application!
Now that we know how to log in using an API request, we can use what we've learned to add new resources via API request!
Unless you are testing the login user experience, don't use the browser to log in. When testing features that require authentication, it's tempting for newer automators to use selenium to log in before each test, or before running a series of tests. This breaks test isolation, in addition to adding unacceptable slowness to the test suite. Learn how to leverage API requests to inject authentication credentials into your browser at test time to speed up you suite.
A complete course on understanding and writing automated tests against web services using HTTP requests in the Python programming language. This course covers academic concepts, hands-on experience with automated testing frameworks and developing within an Integrated Development Environment (IDE), and uses quizzes and challenges to further solidify concepts. Once the course has been completed, the student will be able to speak with authority on the topic of APIs, how web servers communicate with clients, and how to build a reliable, effective test suite against one or many web services using Python. The goal of this course is to prepare students to be able to interview successfully and perform impressively at any job requiring API automation experience.
Combining lectures with hands-on coding and quizzes with problem-solving challenges, Elegant API Automation trains the student to overcome a multitude of challenges facing the modern automation engineer. The course discusses in-depth how Browsers communicated with Web Servers, and how API automation can be leveraged to avoid unnecessary and brittle browser automation in many situations. The student will also gain fluency with Pytest, one of the most popular and powerful Python testing frameworks. The student will learn how to compose well-organized, readable test suites within Pytest, and use several of Pytest's most powerful features such as test search and fixtures.