API Testing
API Testing
The purpose of this course is to provide an overview of API testing and demonstrate how to
perform it in Provar Automation.
We want to make your University of Provar experience as accessible as possible. Please note
that you can navigate directly to lesson content and skip sidebar navigation if you are tabbing
through our course with a screen reader. You can also use these keyboard shortcuts for
alternative navigation.
NOTE: Provar Automation Advanced courses are best completed in conjunction with the use
of our Automation product. Please contact sales@provartesting.com to learn more about
becoming a customer.
Getting Started
Course Note
WR AP UP
Quiz
Course Transcript
Getting Started
use API tests as part of wider end-to-end test scenarios or as stand-alone interface tests
This course should take about 45 minutes, and you will earn an Advanced APIs badge upon
completion.
Lesson 2 of 9
Course Note
We invite you to choose the right learning path for you in this course. Take a moment to decide
where you'd like to begin your learning, and then click the button to start there.
To work through the course in its entirety, including the introduction to API testing, click the button to the right.
START COURSE
Are you a seasoned tester? Want to jump right into API Testing in Automation? Click the button to the right.
LET'S TEST
Lesson 3 of 9
Source
What is an API?
An application programming interface (API) is a connection between computers or computer
programs. This connection is a type of software interface, offering a service to other pieces of software.
APIs allow different pieces of software to connect to each other and exchange information so that users
can receive the information they request.
Consider the image to the left. Notice how the API acts as an intermediary to both the server and the laptop,
facilitating the interaction between the two as needed.
Regardless of your development model, API testing is an important step in understanding the
quality of your application. There are several areas to consider when testing APIs. Click through
the + icons below to learn more about each.
Functionality
Test that the API works as expected and meets pre-determined requirements
Reliability
Security
Performance
Image source
Faster Testing
Testing APIs is faster than going through the UI. This process can be sped up even more with automated
testing.
Testing your APIs validates that a critical component of your software application works as expected,
creating a more robust application and better user experience.
End-to-End Coverage
Including APIs in your test suite gets you one step closer to simulating the entire flow of your users' end-
to-end scenarios. More on this in the next section!
Now that you have a basic understanding of API testing, let's see how you can add depth to your
If your development team has made an API that they want to test, they can do so from within Provar
Automation. This is especially helpful for teams with an API-first approach to development.
Image source
You can also include APIs for end-to-end coverage. When your your users work with applications such as
Salesforce, they likely aren't just interacting with one element on a page. Oftentimes, they are following a
sequence of steps to accomplish a larger task. Your testing needs to be end-to-end to simulate these real-
world scenarios.
End-to-end testing requires a tool that can support all of the components across the entire
business flow, including APIs. Flip through each flashcard below to learn more about how testing
APIs is important at different stages of your flow.
With Automation's support for APIs, you can test your entire business flow in Salesforce and
beyond. This leads to more robust and reliable APIs, ultimately improving the overall quality of the
application. Let's keep going to see how this works.
CO N T IN U E
Provar supports API testing of both web service types so that users have the breadth to cover any
scenario. For each of these web services, Provar provides the standard methods of CRUD
operation.
POST Create
GET Read
PUT Update/Replace
DELETE Delete
Response interpretation
–
Users are able to create dynamic tests by taking the results of one API call and feeding it into future test
steps or test cases. Any response from an API call can be asserted, reported upon, or stored as a variable to
parameterize future test steps.
In addition, you'll also find all of the advanced Provar features that you already know and use
throughout your test cases also apply to API testing.
Assert values
Ready to test your APIs with Provar Automation? Let's keep going to see how you can get started.
Lesson 5 of 9
G E N E RI C W E B S E RV I C E WE B C ONNE C T
A Generic Web Service connection must be created before you can perform API testing. The purpose of the
Generic Web Service is similar to that of a base URL variable, as used in tools like Postman. This is the
connection URL that will be invoked in your test and that subsequent API requests will be based on.
Automation supports multiple authentication types for the Generic Web Service, depending on whether you
are using REST or SOAP services.
G E N E RI C W E B S E RV I C E WE B C ONNE C T
The second part is the Web Connect step. This establishes the connection to the Web Service where the API
is exposed. It becomes the reference to the base URL that was established in the Generic Web Services
connection, creating the URL call for your API. Once the Generic Web Service connection is created, the Web
Connect step will be the first step you drag from the Test Palette to invoke the connection.
Let's look at the Generic Web Services connection first. Click through the + icons below to learn
more about each component of your connection. For more detailed information, check out our
Creating a Web Service Connection documentation.
Connection Name
Connection Type
Select the Connection Type as Generic Web Service. From there, you can select the sub-type. In this example we are
using a Rest Web Service.
URL
Authentication Type
There are six types of REST Connections available. In this example we are using No Authentication, which is a
curated list of APIs that do not require anything beyond a URL in a browser to connect. Learn more about other
authentication types in our documentation.
With the Generic Web Service connection established, the next step is to add the Web Connect
step to your test case. Click through the slides below to see how to add this step or reference our
Invoking the Connection in Web Services documentation.
Adding a Web Connect step
Step 1
Drag and drop the Web Connect step from the Test Palette into your test case.
Step 2
Notice you now have a Web Connect: Connection Name test step in your test case. Select the
required connection from the dropdown list.
You can also choose to set the Result Name, which is the name that the resulting connection will
be stored as, or the Result Scope, which can be set to Test Run, Test Folder, Test Case, Group
Step, or Test Step. By default, it sets to Test Case.
Connection set!
With your connection set, you can now continue with API testing.
CO N T IN U E
Drag and drop the Web Request (REST) step from the Test Palette into your test case.
Step 2
Set the connection name from the dropdown list. The connections listed here will contain
the connections invoked in the Web Connect step.
Set the Resource URL to the endpoint or path you want to reach with your request.
Use the Request Header to pass any header information the API requires. In this example,
we need to pass an access token, so we are using a variable acquired from a previous step.
Content Assist is available for request headers for variables, UniqueId, and more.
Note that JSON body must start with a backslash and curly brace \{ and end with a curly brace
} as shown in the example below.
\{
"clientName": "Valentin",
"clientEmail": "bob{UniqueId(5)}@example.com"
}
Step 4
Result Name is the name that the values resulting form the Web Request will be stored
under.
Result Scope sets to Test Case by default, but it can also set to Test Run, Test Folder, Group
Step, or Test Step. This is the lifetime of the stored response.
Result Status is the name you want the status variable name to be stored under.
As you can see, there are many options for how you configure an API test step in your test case.
For example, in the third step above, we sent the body content to the API endpoint. However, the
body can also be passed in using an uploaded file. Let's see how to accomplish this.
Passing in Body Content with an Uploaded File
Step 1
Select the icon next to the Body cell and choose Template Editor.
Step 2
Use the browse icon to upload a .txt file from your local system.
Step 3
By passing in the body in this way, the syntax of the body will not require a backslash (\) at the
beginning as it did when the body content was sent to the API endpoint. See the example below.
"clientName": "Valentin",
"clientEmail": "bob{UniqueId(5)}@example.com"
Now we've added and configured a REST API in our test case. As previously mentioned, Provar
also supports SOAP APIs. For more information about using them in your test cases, check out
our documentation Creating a Web Service Connection and Invoking the Connection in Web
Services.
CO N T IN U E
Set a variable value based on one of the books returned for use
in a later test.
Now that the test is parameterized, it's important to check how variables are returned. Provar
Automation's Debug mode allows you to see which variables are passed during execution.
Reviewing Variables with Debug Mode
Step 1
Select the test and click the Debug option from Run in the header.
Step 2
You can track the progress of your test in the Test Runner as it runs in Debug mode.
Step 3
Click the Variables tab on the right side of the Test Runner. This shows all the variables used in a
test and allows you to understand more about each one:
Double-click the desired test step to see the updated variable values.
Expand the details of each variable to see the value contained in it.
Expanding the BookDetail variable in the Variables tab shows the returned list of books.
Summary
Passing variables from test to test enriches your end-to-end testing strategy.
Lesson 6 of 9
Quiz
Question
01/05
Which of the following are benefits of API testing? Check all that apply.
Faster Testing
End-to-End Coverage
02/05
True or False: Provar supports testing with REST and SOAP APIs.
True
False
Question
03/05
Drag and drop the API from the Test Palette into the Test Canvas
04/05
05/05
In the example below, what would you put in the resource URL of a request step?
https://example-api.glitch.me/status
\status
.me
example-api.glitch.me
/status
Lesson 7 of 9
use API tests as part of wider end-to-end test scenarios or as stand-alone interface
tests.
You've also earned a Advanced API Testing badge. You can view your badge under “My Badges” on UP.
Lesson 8 of 9
Course Transcript
Email*
Country
Please Select