Automating API Checks With RestSharp

Learn everything you need to start automating API checks using RestSharp

    • Hilary Weaver's profile
  • Intermediate
  • 13
  • 0
193 already enrolled
Things You’ll Need to Get Started
  • Determine Prerequisite Knowledge
  • Recognise Software Needs
Getting the Production Code
  • Locate support when problems arise
  • Locate the demo application code
  • Load a solution in Visual Studio and run it
Learning More About Our API
  • Identify sources of information to test an API
  • Compare the API documentation with API Code
  • Investigate how the UI uses the API
What to Automate
  • Create an automation plan
  • Distinguish between levels of risk to be mitigated by automated checks (or not!)
  • Prioritize an automation plan
Setting up the API Checking Project
  • Evaluate the pros and cons of production code and automation code sharing the same codebase
  • Create an empty project in a .NET solution
  • Install NuGet packages
  • Understand the relationship between NUnit and RestSharp
First Check - a Simple GET Request
  • Implement an HTTP GET request in RestSharp
  • Check the correct HTTP status code is returned
  • Write and run NUnit checks
Second Check - Deserialization
  • Describe deserialization
  • Understand how models are used in automation code
  • Implement a model
  • Check values in the response body
Third Check - a Simple POST Request
  • Explain serialization
  • Implement an HTTP POST request
  • Handle HTTP Headers in RestSharp
  • Assess test data impact
Fourth Check - a PUT Request and Parameterization
  • Implement an HTTP PUT request
  • Understand parameterization and how TestCaseData uses parameterization
  • Implement TestCaseData in NUnit checks
Fifth Check - a Simple DELETE Request
  • Implement an HTTP DELETE request
  • Assess test data setup requirements
  • Understand NUnits Setup feature
  • Implement test data setup with NUnit
Refactoring Opportunities Part 1
  • Define code smells and refactoring
  • Assess automation code smells
  • Refactor automated checks
Refactoring Opportunities Part 2
  • Refactor automated checks
Going Forward
  • Recognize the key learnings of this course
  • Reflect on how you will apply adding automated API checks at your own workplace
  • Know how to continue your learning of RestSharp and API automation

API testing is very popular right now, and for good reason! APIs hold a lot of the business logic that power the interfaces we’re used to testing, but they’re not as visible to us as testers. There’s a lot of value in automating checks against APIs - they’re faster to write, easier to maintain, and generally run much more quickly than UI checks. And, if you already have some experience with C# and some understanding of APIs, you can use a tool like RestSharp to get up and running quickly.

In this course, you'll learn everything you need to start automating checks of APIs using RestSharp in C#, including figuring out what to automate, using NUnit as the test runner, some neat features of NUnit to help keep our test data clean and to parameterize checks, and of course refactoring our code to make it work better than ever. You’ll be able to get your own framework up and running with checks to start adding valuable feedback for your own applications right away.

To successfully complete this course you will need:

  • some basic understanding of APIs
  • some coding skill in C#
  • Some Object Oreintated Programming knowledge

Resources you will use throughout this course:

  • Visual Studio 2022 or 2019 Community Edition
  • .Net 6.0 SDK, or .Net 5 SDK and .Net Core 2.2 SDK
  • Google Sheets
AI Means Centralized Testing Is Inevitable - Jason Arbon
Extra! Extra! Automation Declared Software! - Paul Grizzaffi
Shift Left, Shift Right and improve the Centre - A strategy for testers in continuous delivery context - Gus Evangelisti
Testing Ask Me Anything - API Testing
Moving from Gui to Api Testing: Challenges Faced & Lessons Learnt - Shivani Gaba
The Automated Acceptance Testing Paradox - Mark Winteringham
Explore MoT
TestBash Brighton 2024
Thu, 12 Sep 2024, 9:00 AM
We’re shaking things up and bringing TestBash back to Brighton on September 12th and 13th, 2024.
Beginner's Guide To Mobile Testing
Begin your testing journey in mobile by learning the different aspects of testing mobile