MaxSoft IntelliAPI Documentation
First-ever codeless and lightweight cross-platform API test automation tool
What is IntelliAPI?
IntelliAPI is the first-ever code-free API automation framework which supports behavior driven testing approach with the business language syntax.
The main reason for developing this framework is to provide an easy way for Technical QA/Developer/Non-technical QA to perform API testing.
Advantages
- Ability to implement automated tests for an API within few minutes.
- Codeless API automation.
- Ability to validate backend databases.
- Tests can be designed even by a non- technical person.
- Human readable tests in business language and markdown syntax.
- Generation of an executable document.
- Generate a HTML report with test details for every test execution.
- Parallel execution.
- Live execution report.
- Automated emails for test execution summary with graphical representations.
Technologies/Frameworks Used
- Java
- Gauge Framework
- Rest Assured
- Apache POI
- Junit
- Apache Maven
Supported Platforms
- Windows
- Linux
- Mac OS
Supported Languages
- Java
Design Diagram
Installation
1. Install Pre Requisites
- Java
- Maven
2. Install Gauge Core
On Windows
- Install Chocolatey by executing the following command in an administrator command prompt.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
- Install Gauge by executing the following command in an administrator command prompt.
choco install gauge
On MacOS
- Update Homebrew.
brew update
- Install Gauge using Homebrew.
brew install gauge
On Linux
- First, add Gauge’s GPG key with this command.
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-keys 023EDB0B
- Then add Gauge to the repository list using this command.
echo deb https://dl.bintray.com/gauge/gauge-deb nightly main | sudo tee -a /etc/apt/sources.list
- Finally, install Gauge using these commands.
sudo apt-get update
sudo apt-get install gauge
3. Install Gauge Plugins
- Open administrator command prompt and execute following commands.
gauge install java
gauge install html-report
gauge install json-report
gauge install xml-report
gauge install spectacle
gauge install flash
- You can check the installation using the following command.
gauge -v
- If the installation is success, it will output like this:
Gauge version: <version number>
Plugins
-------
flash (<version number>)
html-report (<version number>)
java (<version number>)
json-report (<version number>)
spectacle (<version number>)
xml-report (<version number>)
Tested Versions
Steps and Usages
General steps
Step 1: Print test execution environment details
Here you will get the below details in the html-report. This can be used inside a specification where you need to get the Operating System
name of the test execution machine, API Environment
and API Base URL
. It will have a better readability if you can use this step in a separate scenario.
Step 2: Wait until a given timeout is expired
You can use this step if you need to pause the execution for some amount of time defined in seconds.
Assume you have invoked some action which will be going through a sequence of actions and while that is happening, the status call will return the response as,
{
"status": "In Progress"
}
At the end of those actions status call will return the response as,
{
"status": "Completed"
}
In this kind of situations you have to wait some time until a process is completed. So here you can use the waiting step in between invoking action and getting the status steps.
Ex:-
API request setting up steps
Step 1: Initialize the API
You need to use this step as the first step in any API automation scenario. This step will help IntelliAPI to identify the API Endpoint
, HTTP Method
, Request Type (JSON/FORM-DATA
and Request Body
which are located in the api_doc.xlsx
file.
You need to use the API_NAME
in the api_doc.xlsx
file as the api_name
in this step.
Ex:-
Step 2: Initialize a GET API using an URL in the response body
Assume you need to invoke a GET API from an URL which is in the response body. In such case, you can use this step.
Note: You must use Step 30, to invoke this GET request. This step 3 is the prerequisite for that.
Ex:-
Step 3: Save values to data stores
There might be the situations where you need to dynamically save some values to use them in another tests. To fulfil that requirement, the data stores were implemented.
There are 3 types of data stores.
- Scenario — Valid until the end of the scenario
- Spec/Specification — Valid until the end of the specification
- Suite — Valid until the end of the test suite
Assume, you are testing a POST request. So first you will invoke the API. Then in the response, you will see the mongo ID for that object. Now you need to make sure that, it can be retrieved from a GET request. For that you have to send the Object ID as a path parameter of the GET request. Here you will need to save that Object ID after you invoke the POST request. Then only you can send that as a path parameter in the GET request.
By using this step, you can save the given values inside the data stores.
Ex:-
Step 4: Save the environmental property values into data stores
From this step, you can save any property value in the property files located in env
folder. These values are saved inside the data stores.
Ex:-
Step 5: Save test data from API document excel file to data stores
By using this step, you can save the test data to data stores from the api_doc.xlsx
file. So that, you can use these values in other tests.
Ex:-
Step 6: Save values inside data stores as a comma-separated list
By using this step, you can have a comma-separated list using the data store values. This comma-separated list also saved as a data store. So that, you can control its validity.
Ex:-
Assuming the data store values as follows,
osanda
is the value saved under a scenario type data store named variable1
.deshan
is the value saved under a spec type data store named variable2
.nimalarathna
is the value saved under a scenario type data store named variable3
.
Here the scenario type data store named var1
will contain the below comma-separated list.
osanda, deshan, nimalarathna
Step 7: Save the current epoch time into data stores
By using this step, you can save the current epoch time in seconds or milliseconds, inside data stores.
Ex:-
Step 8: Convert a given format timestamp into epoch time and save it into data stores
From this step, you can convert a timestamp into epoch time format and save it in data stores.
Note: You can save epoch time in seconds or milliseconds by changing the <secondsOrMillis>
parameter.
Ex:-
Step 9: Generate random emails and save it into data stores
From this step, you can generate a random email and save it in a data store.
Note: For <domainName>, you can use any email domains such as gmail, yahoo, mailinator, yopmail…. etc.
Ex:-
Step 10: Generate random data and save it into data stores
From this step, you can generate random data such as first name, last name, full name and address then save it in data stores.
Note: For <expectedDataType>, you can use below data types,
- FirstName
- LastName
- FullName
- Address
Ex:-
Step 11: Set values to the API endpoint placeholders
Assume you have an API endpoint like below.https://www.googleapis.com/androidpublisher/v3/applications/com.maxsoft.intelliapi.demo/purchases/products/#skuId/tokens/#purchaseToken?access_token=#accessToken
Now you will need to replace #skuId
, #purchaseToken
and #accessToken
placeholders with real values. For that, you can use this step. This will return the URL with the replacement values given above.
Ex:-
This will return the following URL with the replacement values given above.https://www.googleapis.com/androidpublisher/v3/applications/com.maxsoft.intelliapi.demo/purchases/products/com.maxsoft.intelliapi.elementary/tokens/1qwedfdsf3DCBHadw2s78JF?access_token=eyBDS224dfHfjshffignf&76DHB
Step 12: Set values to the API endpoint placeholders using data stores
You can also replace the API endpoint placeholders, by using the data store values, as the placeholder values. For that, this step can be used.
Assume you have an API endpoint like below.https://www.googleapis.com/androidpublisher/v3/applications/com.maxsoft.intelliapi.demo/purchases/products/#skuId/tokens/#purchaseToken?access_token=#accessToken
Now you will need to replace #skuId
, #purchaseToken
and #accessToken
placeholders with the data store values. For that, you can use this step. This will return the URL with the replacement values stored in the data stores given above.
Ex:-
This will return the following URL with the replacement values stored in the data stores given above.https://www.googleapis.com/androidpublisher/v3/applications/com.maxsoft.intelliapi.demo/purchases/products/com.maxsoft.intelliapi.elementary/tokens/1qwedfdsf3DCBHadw2s78JF?access_token=eyBDS224dfHfjshffignf&76DHB
1qwedfdsf3DCBHadw2s78JF
is the value saved under a scenario type data store named purchaseToken
.eyBDS224dfHfjshffignf&76DHB
is the value saved under a scenario type data store named accessToken
.
Step 13: Set current timestamp into a row in a CSV file
You might need the current timestamps for your tests. For that, you can use this step. This will save the current timestamps in all the rows in a given column of a given CSV file.
You need to provide the column name of the CSV file where you need to have current timestamps in all the rows, CSV file path and the timestamp pattern.
Note: IntelliAPI will first read the row and replace the row value with the current timestamp. This operation will be recursively happen until the end of the rows. So the row values of that column might be identical with the timestamps. You can use this step whenever you need some identical values.
Ex:-
This will replace the row values in timestamp
column of the CSV file with the current timestamps.
Step 14: Set the request headers
In web services, you might need to use headers with the APIs. In such cases you should use this step to embed the required headers with the API payload.
Note: Authorization is also usually provided as a header of the API. But in IntelliAPI, it is configured by the framework to take that as a header. So you don’t need to worry about the authorization header in this step.
Ex:-
Step 15: Set the request headers using data stores
You can also set the request headers, by using the data store values, as the header values. For that, this step can be used.
Ex:-
Step 16: Set the request attribute values
From the above steps, you have initialized the API endpoint. So now you will need to set the JSON request body to invoke the API request. For that, this step can be used.
In the project folder, navigate to resources/api_document
folder. Here you have the excel files based on the test execution environments. This files contain the template of the APIs.
In this step simply what you are doing is, replacing the JSON payload template placeholders with the desired values.
Ex:-
This will return the JSON request body as follows,
{
"comment":"This is the comment",
"username":"Osanda",
"rating":"Awesome",
"appId":"sfc_mvp",
"email":"maxsoft-android-demo",
"appName":"sfc_mvp_ios"
}
Step 17: Set the request attribute values using data stores
You can also set the JSON request body to invoke the API request, by using the data store values, as the attribute values. For that, this step can be used.
Ex:-
Assuming the data store values as follows,
Osanda
is the value saved under a scenario type data store named creatorId
.API
is the value saved under a spec type data store named creatoredSource
.
This will return the JSON request body as follows,
{
"creatorId":"Osanda",
"creatorPlatform":"Web",
"creatoredSource":"API"
}
Step 18: Set the request payload using a text file
From this step, you can directly set the JSON request body by using a text file.
Ex:-
Step 19: Set values to the request payload placeholders
You might need to change the request attribute values after setting the JSON request body. Assume you need to pass some ids to the JSON request body after you set it. For that this step can be used. This will read the current JSON request body and modify it by replacing the placeholders with the desired values.
Ex:-
Before modifying the JSON request body,
{
"username":"#username",
"accessingPlatform":"Web",
"password":"#password"
}
After using the above step, it will return the JSON request body as follows,
{
"username":"osanda12",
"accessingPlatform":"Web",
"password":"Password1"
}
Step 20: Set values to the request payload placeholders using data stores
You can also modify the JSON request body, by using the data store values, as the attribute values. For that, this step can be used.
Ex:-
Before modifying the JSON request body,
{
"username":"#username",
"accessingPlatform":"Web",
"password":"#password"
}
Assuming the data store values as follows,
osanda12
is the value saved under a spec type data store named username
.Password1
is the value saved under a spec type data store named password
.
After using the above step, it will return the JSON request body as follows,
{
"username":"osanda12",
"accessingPlatform":"Web",
"password":"Password1"
}
Step 21: Set the form-data request key-value pairs
In form-data type request, you are passing the key-value pairs instead of the JSON body. To set the key-value pairs, this step can be used.
Ex:-
Step 22: Set the form-data request key-value pairs using data stores
You can also set the key-value pairs, by using the data store values, as the values. For that, this step can be used.
Ex:-
Step 23: Set the form-data request multipart file upload
Assume you need to test a multipart file upload using a form-data request. For that, this step can be used. In here, you need to provide the key name for the form-data key and the file path with the mime type of the multipart file.
Ex:-
Step 24: Set the query parameters
If you need to append some query parameters to the API endpoint, you can use this step. This will return the API endpoint as follows,
<baseUrl>?<queryName1>=<queryValue1>&<queryName2>=<queryValue2>
Ex:-
After using the above step, it will return the API endpoint as follows,
http://10.199.253.83:8082/api/questions/count?deckId=5a603af62e02d86561172dac
Step 25: Set the query parameters using data stores
You can also set the query parameters, by using the data store values, as the query values. For that, this step can be used.
Ex:-
Assuming the data store value as follows,
5a603af62e02d86561172dac
is the value saved under a spec type data store named myDeckIdWithQuestions
.
After using the above step, it will return the API endpoint as follows,
http://10.199.253.83:8082/api/questions/count?deckId=5a603af62e02d86561172dac
Step 26: Set the path parameters
If you need to append some path parameters to the API endpoint, you can use this step. This will return the API endpoint as follows,
<baseUrl>/<pathParamValue1>/<pathParamValue2>
Ex:-
After using the above step, it will return the API endpoint as follows,
http://10.199.253.83:8082/api/deckId/5a603af62e02d86561172dac
Step 27: Set the path parameters using data stores
You can also set the path parameters, by using the data store values, as the path parameter values. For that, this step can be used.
Ex:-
Assuming the data store value as follows,
5a603af62e02d86561172dac
is the value saved under a scenario type data store named expertDeckId1
.
After using the above step, it will return the API endpoint as follows,
http://10.199.253.83:8082/api/deckId/5a603af62e02d86561172dac
Step 28: Set request authentication configurations
From this step, you can configure the way you want to authorize this API. If no authentication required, you can ignore this step.
If you need to authenticate the API using a given token, you can follow the below configurations.Is authentication required?
YesDo you need to retrieve the access token from the text file?
NoProvide the access token if you need to authorize the API manually
<Provide your token here>
If you need to authenticate the API using the previously saved token, you can follow the below configurations. (Globally saving the token is described under Step 40)Is authentication required?
YesDo you need to retrieve the access token from the text file?
YesProvide the access token if you need to authorize the API manually
N/A
Ex:-
API request invoking steps
Step 1: Invoke API
After you have provide all the test data and finalize the API payload, you can use this step to invoke the API and get the response.
Step 2: Invoke GET API using the endpoint saved in the data store
Assume you need to invoke a GET API from the endpoint which you have already saved in a data store. In such case, you can use this step.
Note: You can use this step after the Step 3 (prerequisite is the step 3). Then this will invoke the GET request from the URL saved in step 3.
API response validation steps
Step 1: Validate the response status code
By using this step, you can validate the response status code of the API.
You should provide the expected response status code here. If it is not matched with the actual response code, an assertion error will be thrown.
Ex:-
Step 2: Validate the response content by JSON path value contains
From this step, you can check whether the response contains your expected values.
Ex:-
Step 3: Validate the response content by JSON path value contains using data stores
From this step, you can check whether the response contains your expected values, by using the data store values, as the expected values.
Ex:-
Step 4: Validate the response content by JSON path value not contains
From this step, you can check whether the response not contains your expected values.
Ex:-
Step 5: Validate the response content by JSON path value not contains using data stores
From this step, you can check whether the response not contains your expected values, by using the data store values, as the expected values.
Ex:-
Step 6: Validate the response content by exact JSON path value
From this step, you can check whether the response exactly equals to your expected values.
Ex:-
Step 7: Validate the response content by exact JSON path value using data stores
From this step, you can check whether the response exactly equals to your expected values, by using the data store values, as the expected values.
Ex:-
Step 8: Validate the response content by JSON path value not equals
From this step, you can check whether the response not exactly equals to your expected values.
Ex:-
Step 9: Validate the response content by JSON path value not equals using data stores
From this step, you can check whether the response not exactly equals to your expected values, by using the data store values, as the expected values.
Ex:-
Step 10: Validate the response content by JSON path existence
From this step, you can check whether the existence of your expected JSON paths in the response.
Ex:-
Step 11: Validate the JSON schema of the response
From this step, you can check whether the API response is matched with the expected JSON Schema.
Note: To get the JSON Schema for a response, you can use below tool.
https://www.liquid-technologies.com/online-json-to-schema-converter
Ex:-
API response data saving steps
Step 1: Save the JSON path values into data stores
There might be the situations where you need to dynamically save some values to use them in another tests. To fulfil that requirement, you can use this step. This will save JSON path values in data stores.
Ex:-
Step 2: Save the access token in the response globally
From this step, you can save a JSON path value as the access token which can be used in all the other tests.
Ex:-
Step 3: Save the JSON path values into text files
By using this step, you can save the JSON path values into text files. Then you can use those values for later tests.
Ex:-
Step 4: Save the JSON Array values into CSV files
From this step, you can split the JSON array values in a JSON path and save them one by one in the rows of the given CSV file.
Ex:-
Data store comparison steps
Step 1: Validate a data store value is equal to the expected value
By this step, you can validate data store values are equal to your expected values.
Ex:-
Step 2: Validate a data store value is equal to another data store value
From this step, you can validate that the two data store values are equal.
Ex:-
Step 3: Validate a data store value is not equal to the expected value
By this step, you can validate data store values are not equal to your expected values.
Ex:-
Step 4: Validate a data store value is not equal to another data store value
From this step, you can validate that the two data store values are not equal.
Ex:-
Step 5: Validate a data store value contains the expected value
By this step, you can validate data store values contains your expected values.
Ex:-
Step 6: Validate a data store value contains another data store value
From this step, you can validate that a data store value contains another data store value.
Ex:-
Step 7: Validate a data store value not contains the expected value
By this step, you can validate data store values not contains your expected values.
Ex:-
Step 8: Validate a data store value not contains another data store value
From this step, you can validate that a data store value not contains another data store value.
Ex:-
Data store arithmetic operation steps
Step 1: Add integer values in data stores and save it in a new data store
By this step, you can add the integer values saved in data stores and save the total in a new data store.
Ex:-
Step 2: Subtract integer values in data stores and save it in a new data store
By this step, you can subtract the integer values saved in data stores and save the final value in a new data store.
Ex:-
Step 3: Divide integer values in data stores and save it in a new data store
By this step, you can divide the integer values saved in data stores and save the final value in a new data store.
Ex:-
Step 4: Multiply integer values in data stores and save it in a new data store
By this step, you can multiply the integer values saved in data stores and save the final value in a new data store.
Ex:-
Step 5: Add decimal values in data stores and save it in a new data store
By this step, you can add the decimal values saved in data stores and save the total in a new data store.
Ex:-
Step 6: Subtract decimal values in data stores and save it in a new data store
By this step, you can subtract the decimal values saved in data stores and save the final value in a new data store.
Ex:-
Step 7: Divide decimal values in data stores and save it in a new data store
By this step, you can divide the decimal values saved in data stores and save the final value in a new data store.
Ex:-
Step 8: Multiply decimal values in data stores and save it in a new data store
By this step, you can multiply the decimal values saved in data stores and save the final value in a new data store.
Ex:-
Other data store processing steps
Step 1: Concatenate values in data stores and save it in a new data store
By this step, you can concatenate values saved in data stores and save the final value in a new data store.
Ex:-
Note: Here, you might need to have a space between the values in two data stores. For that, you can use the data store variable name as ${SPACE}
Ex:-
Step 2: Read values in data stores
From this step, you can print the data store values.
Ex:-
Here you will get the below details in the html-report.