Ranorex Logo

Support Corner: API Testing with Ranorex Studio and a GET Request

|
Support Corner - API Testing|||

Ranorex is a powerful no-code tool that automates web, mobile, and desktop application testing, including robust API testing capabilities. In addition to the powerful no-code recording, you can utilize the Ranorex API to create code modules in C# or VB.NET. That’s beneficial because it can increase the effectiveness of your testing suite

In this blog, we will share some code you can use. We will create a simple script to test a GET request from an API. 

How It’s Done

To start, we will create a user code collection. A user code collection is defined as a collection of user code methods that belong together logically. All user code collections together make up the user code library. You could also add the code inside a code module, but using the code collection will allow it to be reused more easily across different recording modules.

Inside the user code collection, we will import the System.Net namespace.

using System.Net;

We will also add the following code method. You can easily add methods to a user code collection by right-clicking inside the main class and selecting “Insert new user code method…” 

The following method takes in one parameter — the URL of the GET request we want to perform. Since this is a relatively simple example, the URL will be assumed to contain all the needed parameters. However, the method can be modified to take in a base URL and parameters and then combine those as needed. It also returns the response as a string. Further processing of the response can be done with JSON libraries, but we will return the whole string for this blog. 

       public static string GetRequest(string url)
        {
            using (var wb = new WebClient())
            {
                var response = wb.DownloadString(url);
                return response;
            }
        }

To use the method we created in the user code collection, we can go to a recording module and Add New Action -> User Code -> Select from library. You should see the GetRequest method we just added.

You can use that method to send a simple GET request and save the request’s response. In this case, we save the response to a variable and then log the variable to the Ranorex report. Another quick test is to validate that the response is what we expect using the Ranorex validation action. 

Next Steps — Try It for Yourself

Overall, running a quick API test with Ranorex is very simple. In future blogs, we will cover how to deserialize the request responses and how to use RestSharp inside of Ranorex Studio for more robust API testing. Are you ready to take your testing to the next level? Start your free trial of Ranorex today and try our robust QA testing automation tools, including API testing.

In This Article

Sign up for our newsletter

Share this article

Related Articles

Sembi-Software-Quality-Pulse-Report-2026-blog-image

The State of Test Automation in 2026: Key Findings from the Software Quality Pulse Report

May 19, 2026
A sneak peek at key findings from Sembi’s first-ever industry-wide survey | Ranorex We surveyed nearly 4,000 QA engineers, developers, security professionals, and engineering leaders to understand the real state of software quality in 2026. The inaugural Sembi Software Qual...
Top-5-Automated-Testing-Tools-for-Web-Applications-Selenium,-Cypress,-Playwright,-TestCafe,-and-Ranorex-Compared-new-blog-image

Top 5 Automated Testing Tools for Web Applications: Selenium, Cypress, Playwright, TestCafe, and Ranorex Compared

May 14, 2026
TLDR The best automated testing tool for web applications depends on your team, your stack, and how much framework setup you want to own. For open-source flexibility, Selenium remains a leading browser automation standard. For modern web apps and strong debugging, Cypress and Pla...
End-to-End-Testing-A-Complete-Guide-to-E2E-Test-Automation-blog-image

End-to-End Testing: A Complete Guide to E2E Test Automation

March 12, 2026
TL;DR: End-to-end testing validates complete user workflows from start to finish, catching integration failures that unit and API tests miss. E2E tests simulate real user behavior across the full application stack. While slower than unit tests, E2E testing increases confidence th...