Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

API Testing

The Provar Automation Advanced course focuses on API testing, teaching users how to perform API tests using Provar Automation. Participants will learn the benefits of API testing, how to integrate it into broader testing strategies, and will earn an Advanced APIs badge upon completion. The course includes practical lessons on setting up API connections, executing tests, and utilizing variables for enhanced testing efficiency.

Uploaded by

sikander
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

API Testing

The Provar Automation Advanced course focuses on API testing, teaching users how to perform API tests using Provar Automation. Participants will learn the benefits of API testing, how to integrate it into broader testing strategies, and will earn an Advanced APIs badge upon completion. The course includes practical lessons on setting up API connections, executing tests, and utilizing variables for enhanced testing efficiency.

Uploaded by

sikander
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Provar Automation Advanced: API Testing

Course Contributor: Nick Sayles


Course Designer: Caroline Smith

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.

INTR ODUC TION

Getting Started

Course Note

API TES TING WITH AUTOMATION

Introduction to API Testing


API Testing with Provar Automation

API Testing with REST APIs

WR AP UP

Quiz

Summary & Badge

Course Transcript

Tell us what you think!


Lesson 1 of 9

Getting Started

By the end of this course, you will be able to. . .

explain the process and benefits of API testing

perform API testing in Automation

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

A Note about APIs


Provar Automation uses APIs to facilitate many functions, so there are various ways we might
refer to them. For example, you learned how Provar uses Salesforce APIs to facilitate easy drag-
and-drop test authoring in Provar Automation Essentials: Salesforce APIs. Additionally, many of
the test steps in our Test Palette are APIs that are used to call certain functions, as seen in the
microlearning Custom APIs. For the purposes of this course, though, we are discussing how to
perform API testing with Automation.

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

Introduction to API Testing

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.

What is API Testing?


API testing validates that the software interface that's connecting the two systems sends and
receives information as expected. This becomes increasingly important for teams with an API-
first approach to development. As the name suggests, this method of building an application
prioritizes APIs above all else, making API testing that much more valuable.

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

Test the consistency of the API


Security

Identify potential vulnerabilities in the API


Performance

Test the responsiveness of the API

Image source

Why is API Testing important?


APIs are used as part of a broad and high-value testing strategy. Let's look at just a few of the
benefits of including them in your test suites.

Faster Testing
Testing APIs is faster than going through the UI. This process can be sped up even more with automated
testing.

Improved User Experience

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

test cases by building them in Provar Automation.


Lesson 4 of 9

API Testing with Provar Automation

Testing Strategy with APIs


As mentioned in the previous section, APIs are an important piece of your testing strategy. With
Automation, users can perform API testing as stand-alone interface tests or as part of wider end-
to-end testing scenarios. Let's look more closely at each.
Image source

The API as a stand-alone test

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

The API in a wider end-to-end test scenario

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.

Collect test data dynamically from


Collect data third party systems with an API at
the beginning of a test case.

Trigger a task to run on a third


party system with APIs. Confirm
Trigger a task the intended action has occurred
(and verify the outcome of the
test) by using the same API.
Produce test data at any point in
the test case, which the
Produce data
subsequent test steps can then
consume.

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

API Testing with Web Services


Automation leverages web services to provide standardized ways for software to interact, making
it easier to simulate real-world scenarios in your test cases. In the realm of web services, two
primary API data transmission approaches are often used.

SOAP (Simple Object Access Protocol) is a W3C-endorsed, XML-based


1
protocol that enables two applications to communicate over a network. It
provides a structured methodology for accessing web services, making it
a key player in the API landscape.

2 RESTful (Representational State Transfer) is an architectural style rather


than a protocol. It simplifies the representation of server-side data, making
it easily accessible for applications. This approach has become a popular
choice for API implementation.

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.

HTTP Method CRUD

POST Create

GET Read

PUT Update/Replace

PATCH Partially Update/Modify

DELETE Delete

Enhanced Functionality and Advanced Features


With Provar, you can expect first-rate functionality. Click the + icon to expand each section and
learn more about each one.
Customizable request headers

With Automation, users can pass in their own headers to test APIs that use customized request headers,
such as Authorization headers.

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.

Multiple syntax formats for request bodies



Users have support for multiple body types, including a custom body type, to accommodate different data
formats and server configurations.

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

Set variables based on API responses

Parameterize API tests by using variables in the header or request body


Reporting

Ready to test your APIs with Provar Automation? Let's keep going to see how you can get started.
Lesson 5 of 9

API Testing with REST APIs

Connections for your API


Testing an API requires a connection to it. There are two components to the connection you need
to set for your API test steps: Generic Web Service connection and Web Connect.

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

Name the connection according to your naming conventions.


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

Add the base URL for the connection.


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 from the Test Palette.

Drag and drop the Web Connect step from the Test Palette into your test case.
Step 2

Configure the test step

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

Adding a REST API


Now it's time to perform the API request in your test case. We'll continue with the REST API we set
up in the Generic Web Services connection.
Adding a REST API
Step 1

Add the REST test step

Drag and drop the Web Request (REST) step from the Test Palette into your test case.
Step 2

Configure the REST test step

Define these parameters:

Set the connection name from the dropdown list. The connections listed here will contain
the connections invoked in the Web Connect step.

Set the REST type to Generic REST Service.

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.

Separate multiple request headers by a carriage return.

Content Assist is available for request headers for variables, UniqueId, and more.

Select the necessary method for your request.


All methods except for Get require a Body. If needed, select the body type.
Step 3

Enter the body content to send to the API endpoint

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

Fill in the Results section

For all method types, the Results section needs to be completed.

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

Open the Template Editor

Select the icon next to the Body cell and choose Template Editor.
Step 2

Upload your file

Use the browse icon to upload a .txt file from your local system.
Step 3

Format the body

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

Using Variables in API Testing


Variables are helpful to use in test cases, including those with APIs. Let's first take a look at the
actions to be performed in our example.
Setting Variables with an API
Step 1

Connect to a configured web services


Step 2

Return a list of the books from the API endpoint.


Step 3

Set a variable value based on one of the books returned for use
in a later test.

The variable value is set to BookID.

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

Run the test in Debug mode

There are two ways to run a test in Debug mode:

Right-click the test and select Debug Test(s).

Select the test and click the Debug option from Run in the header.
Step 2

Track the test progress

You can track the progress of your test in the Test Runner as it runs in Debug mode.
Step 3

Expand the variable

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

Improved User Experience

Perfect API Performance


Question

02/05

True or False: Provar supports testing with REST and SOAP APIs.

True

False
Question

03/05

What is the first step in API testing with Provar Automation?

Create a Generic Web Service connection

Add a Web Connect step

Drag and drop the API from the Test Palette into the Test Canvas

Pass in body content


Question

04/05

Which of the following are available with APIs in Provar Automation?

Assert values returned in responses

Customize request headers

Use custom body types


Question

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

Summary & Badge

Congratulations on completing the Advanced API Testing course.

You should now be able to. . .

explain the process and benefits of API testing.

perform API testing in Automation.

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

Advanced API Testing.pdf


1.3 MB
Lesson 9 of 9

Tell us what you think!

First name* Last name*

Email*

Country

Please Select

What course are you providing feedback for?

You might also like