Subscribe

UiPath Studio

The UiPath Studio Guide

API Test Automation

Studio Pro supports API Test Automation projects through its integration with Postman, a software development tool for performing test calls to APIs. This integration also includes Newman, a command-line collection runner for Postman for running and testing a collection directly from the command-line.

API collections created in Postman can be imported in Studio Pro using the New Service wizard for libraries, access to the collection is granted through the Postman API key. Imported collections can be used for testing projects. Details about Postman prerequisites are available here.

In the context of testing, Postman collections imported in Studio Pro libraries may be published as a .nupkg package locally or in Orchestrator, and then installed as dependencies in test automation projects.

Example of API Test Automation

The following example uses a data collection defined in Postman, imports it in a Studio Pro library, publishes the library with the collection, installs it in a testing project, and uses testing activities part of the UiPath.Testing.Activities pack to verify the data usage.

The test cases are designed for a workflow that automatically applies for loans and retrieves loan data for bank customers.

To check Postman and Newman installation prerequisites read this page.

Define a Data Collection

In Postman, either define a data collection or import an existing one to your current workspace. We created a data collection for applying for a loan, retrieving, and deleting loan details. When used in a API test project, this collection checks whether the logic of our workflow is correct.

1492

Import Collections

To import a collection in Studio Pro, create a library project and make use of the New Service window. Access to the collection is granted through the Postman API key. Add this key in the File or Link field and click Load.

938

Select only the endpoints you would like to load in your project, and add a new Namespace if needed.
Check the Linked collections box so that a link is used so the newest version of your collection is executed at runtime, instead of a version stored locally. Click Save when done.

Using Data Collections

After the collection is imported in the Studio Pro library, its endpoints are automatically transformed into activities, available in the Activities tab, under the namespace that you previously set.

402

In our example, a separate Sequence file was created for each activity generated from the endpoints.

1023

After adding an activity, add the Postman environment (in between quotes "") in the Properties panel.

1114

Data values defined in the Postman collection are imported as Arguments:

827

Libraries can be published locally or in Orchestrator as a .nupkg package.

Load Library in API Test Project

  1. Create a test project in Studio using the Test Automation project type.
581
  1. Install the published library as a dependency using the Manage Packages window.
446
  1. Sequence files previously defined in the library are now available in the Activities panel under the library's namespace, together with activities generated from the Postman import.
448
  1. Use these activities in your API test automation project, combined with activities part of the UiPath.Testing.Activities pack. We created a test project to verify the data entered when applying for a loan in our demo application. This small test uses a set of hardcoded variables, visible here in the Properties panel:
949

This simple test process was used as a smoke test, to check if the application responded correctly. Several such tests can be created in StudioPro, depending on your automation needs.

  1. To verify several scenarios in one test project, go to the ribbon, New > Data Driven Test Case. Import the data set, as explained here. Below is an example of such a test case. The values are now stored into arguments, mapped in the activity.
987
  1. Select Run file or Debug file with data variations and choose the data to use. This is useful when testing several scenarios with multiple data sets.
815
  1. After running the process, the results are visible in the Output panel.
974

Updated 2 years ago


API Test Automation


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.