
This introduction session will let you get started with REST API automation using RestSharp
Apply the data transfer object pattern to encapsulate JSON data in a single model for API calls. Create a C# DTO from JSON using Quicktype or Visual Studio.
Create a public helper library that encapsulates RestSharp client creation, request building with headers, response handling, and JSON deserialization, with generic methods for flexible models.
Leverage a helper class to streamline rest api testing with RestSharp and SpecFlow by creating a client, building a get request, and parsing the response into the model.
Create a post request method that accepts a payload and sets the HTTP method. Use a header of application/json to handle the post request body.
Learn to test a post /api/users endpoint by creating a create user response model, using a helper for post requests and a unit test that asserts the payload name Morpheus.
Utilize MSTest TestContext to configure deployment items and data sources from a csb file, populate a create user request from test context data, and prepare payload handling for next sessions.
Update the framework to reflect changes by replacing the helper class with Handal content, a static class, and access its methods directly via the class name without creating objects.
Validate http responses by checking status codes and content, and refactor the demo to return the full response. Update tests to assert 200 status code.
Switch from per-field mapping to a single handle content method to load json payloads from test data files into the model, enabling multiple json files and payload verification.
Make the testing framework more generic by passing the base url from tests and decoupling the helper class, ensuring reusable code with constants named in all caps.
Add and configure put and delete requests in a RestSharp SpecFlow testing framework by building request objects with headers and a JSON payload, mirroring post and get methods.
Install a NuGet package and implement an ExtentReports-based reporter to create tests, log steps, and flush results for REST API tests with RestSharp and SpecFlow.
Update the test class to use the report utility, initialize the report with test context, and log outcomes to generate a smoke test report with status.
Have updated this section to fix issue of project and file name changes.
Explore the latest changes in the new version of rest api testing with RestSharp and SpecFlow, including deprecations, migrating from synchronous to asynchronous methods, and updating interfaces.
Upgrade your rest api client to RestSharp v107 by refactoring deprecations, switching to rest response and json payloads, and adjusting async calls, requests, and tests for compatibility.
RestSharp (Probably, the most popular REST API client library for .NET) is a powerful library to automate REST API using C#. This course is designed to cover basic to advance concepts of REST API automation. Even with basic knowledge of C#, you will be able to follow and implement. I will explain about important part of RestSharp and how to automate your REST API tests. I have used NewtonSoft Json .NET to serialize and deserialize JSON.
***JAN 2022: COURSE UPDATED TO WORK WITH RESTSHARP v107 (which is major upgrade)***
Deprecated interfaces
IRestClient: will be using the RestClient class instance.
IRestRequest: will be using the RestRequest class instance.
IRestResponse: will be using the RestResponse class instance.
IHttp
This course provides many different practical scenarios and implementation. Overview of the course topics
Basics of Rest APIs
Basics of API testing
Introduction of RestSharp
Basic to advance concept of RestSharp
Implementation of API Automation Framework
Custom helper classes
Working with Json .Net
Integration of BDD SpecFlow
Handling of large payloads using Models
Data driven testing
Extent reports
You will be able to implement API test framework with best coding practices in the industry. This solution can be utilized to automate your project REST APIs without major changes. I will try to keep course updated with any changes in the RestSharp library as soon it is released.