API Testing

Generate an API Client to test your API

Getting started

In case you have not yet created a solution , follow our guide on how to create a Solution in Visual Studio. During the creation wizard create a Software Version with Installation Type "API"

If you already have a solution create the API Software Model in the Portal and add it to your Solution using the Testresults.io Context Menu:

API Explorer and API Call Designer

For API Testing you will mainly use the two windows API Call Designer and API Explorer. The API Call Designer helps you to create and edit saved API Calls. The Api Explorer is used to give you an overview of the saved API Calls.

Import your Swagger or OpenAPI specification

The easiest way to start API Testing is to import the Swagger or OpenAPI specification file of your API. You can still use all functionality in case you do not have a API specification file, use the API Call Designer to create your API Model.

Note: We support Versions v2.x and v3.x and while APIs may be defined in either YAML or JSON format, the importer only supports JSON files for now.

To import your Json file navigate to the API Explorer and select the Import Icon.

In case you already created an API Model for the same API you can still import a file. But already saved API calls will be deleted and overwritten by the import.

After the import the API Explorer will display the API structure. A subfolder will be created for each Tag, Path and Operation Verb. The last element in the hierarchy is an example API Call which is automatically generated. If you double click on it you can edit and test the API call inside the API Call Designer. In case your API changes you can also add new Paths and Operations using the API Call Designer.

API Model and generated Classes

The imported or manually saved API Calls will also create a C# Project and Classes which will be used in the Test case itself.

The project contains a main class (in this example in the testresultsio.cs file) which has access to all the different Api Paths. For each Tag a Class is generated in the Folder Api, for each Schema Object a class is generated in the Model folder.

Following the same principle as with our Screen classes, each class is split into a ".cs" file which you are free to extend and a generated "g.cs" partial class file.

Make sure to regenerate the Classes incase you change something, using the Icon in the API Explorer.

Using the API Model in a Test case

In case you do not have created a Test case yet, use the context action on the Solution to create one. During the creation make sure to select the API Model as the Software model, so all project references are automatically created.

Inside the Testcase the Api is accessible using the Keyword Api

Last updated