Загрузка...

API Testing with Testim: A Step-by-Step Demo

Testim - https://shorturl.at/kT245
DEMO - How to do API testing with Testim
How to retrieve and store values from API step
Using Parameters in API Steps

In Testim, we can call APIs within UI Tests for:
Validation
Data inquiry
Data retrieval etc

There are two types of API steps
Add API action – to get data that is returned from an API call. Can store and use this data
Validate API - to validate data returned from an API call, usually validating data in the backend


DEMO - How to do API testing with Testim

Step 1 - Hover over the arrow or + symbol where you want to add the Add API validation step
Step 2 - Click the “M” (Testim predefined steps)
Step 3 - Click on Validations. Search for api select Add API Action or Validate API
Step 4 - Enter a name for this step. Check or uncheck Shared step checkbox
(Shared step will make the step available to reuse in this or other tests)
Step 5 - Click Create Step. API Validation window opens
Step 6 - Add the Method, URL, Headers, Authorization, Body fields as per your API request
Step 7 - Can optionally add Assertions
Step 8 - To perform additional assertions can add scripts in Run additional code on request results
Step 9 - Save and Run

How to retrieve and store values from API step

Step 1 - Open the API Step
Step 2 - Goto section Run additional code
Step 3 - Add the code to get a value from response
if (responseBody.data.first_name == "Janet")
return true;
throw new Error('FAILED. Name is not Janet')

Step 4 - Store the value in a parameter
exports.firstName = responseBody.data.first_name
Step 5 - Can use this in any subsequent step
console.log("this firstName exported from the previous API step: "+ firstName);

Using Parameters in API Steps

Step 1 - Goto the properties of API Step
Step 2 - Create parameters as needed
Step 3 - Go inside the API Step and refer parameters as needed

The API Step includes the following text sections that support using the defined parameters:
Request URL - refer parameters using double or triple brackets {{{param}}}
Header - refer parameters using double or triple brackets {{{param}}}
Body - refer parameters using double or triple brackets {{{param}}}
Assertion
Function editor

Step 4 - Save and Run

#Testim #APITesting #RESTAPI #APIAutomation #TestingDemo #Postman #Swagger #API
All Step by Step Tutorials 🟢 https://AutomationStepByStep.com/
▬▬▬▬▬▬▬

Share with all who may need this

If my work has helped you, consider helping any animal near you, in any way you can

Never Stop Learning
Raghav Pal
▬▬

Видео API Testing with Testim: A Step-by-Step Demo канала Automation Step by Step
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять