-
Notifications
You must be signed in to change notification settings - Fork 16
Postman Integration and Overrides
Julio Zevallos edited this page May 17, 2019
·
25 revisions
This page will give you the understanding and implementation of postman collection for API testing.
- Create an API postman collection in standard format of postman (Of Postman v2.0.0 , and v2.1.0). Recommended is to export the API request format as collection from postman.
- Create a folder with the service name with in the
models
folder and keep the collection inside of the service. - Create a test suite (.xlsx) with in the
suites
folder and update the test datat-
tab with the test steps. - In test steps update the
Action
asServiceCall
,Target
asservicename.requestname
orservicename.foldername.requestname
frommodels
(Spaces are supported in folder names and request names),Input
as the API calling methodPOST or GET or PUT or DELETE or any other
, rest of the fields can be more generic. - Go to
exmaple_usage/bin
in command prompt and execute asrun.bat <testsuitename.xlsx>
- Verify the logs and extended report for the test results.
From the sampletest.xlsx "t-omdb&imdb" tab, line 3 you will find the following columns (partial set):
Step | Action | Target | Input |
---|---|---|---|
omdb call | serviceCall | omdb.Wall-E | GET |
omdb call2 | serviceCall | omdb.othermovies.The Lion King | GET |
omdb call3 | serviceCall | omdb.othermovies.scarymovies.Shaun of the Dead | GET |
Sample Test spreadsheet path: "example_usage/suites/testdata.xlsx"
- This entry uses the Target value, find the "sample" postman collection, and reads the URL, looking for "Wall-E" as the intended request name.
- If the desired request is in a collection folder, such as omdb.othermovies.The Lion King , will search for the folder "othermovies", then look for the request "The Lion King" in there.
- Note that we support recursive folders. Example, the Shaun of the Dead entry.
Postman collection path: "example_usage/models/omdb/postman_collection.json"
- It then looks at the Overrides value, and replaces the values found in double brackets "{{valueToUse}}" with the corresponding value found in the testdata.xlsx spreadsheet.
Test data spreadsheet path: "example_usage/testdata/testdata.xlsx"
This feature can be used to parse test data based on environment (Dev/Prod) without changing the postman collection.
- Create an API postman collection in standard format of postman and key-values should be as variables
<{{varname}}>
. Recommended is to export the API request format as collection from postman. - Create a folder with the service name with in the
models
folder and keep the collection inside of the service. - Create a test suite (.xlsx) with in the
suites
folder and update the test datat-
tab with the test steps. - In test steps update the
Action
asServiceCall
,Target
asservicename.path
frommodels
,Input
as the API calling methodPOST or GET or PUT or DELETE or any other
andOverrides
column should have values for variables in postman collection like<bodytemplate::key-var-value::key-var-value-toReplace>
, rest of the fields can be more generic. - Multiple
Overides
can be accepted like<bodytemplate::key-var-value1::key-var-value-toReplace1::key-var-value2::key-var-value-toReplace2>
. - Go to
exmaple_usage/bin
in command prompt and execute asrun.bat <testsuitename.xlsx>
- Verify the logs and extended report for the test results.
This feature can be used when the user wants to in different environments with out changing the postman collection.
- Create a folder with the service name with in the
models
folder and keep the collection inside of the service. - Create a test suite (.xlsx) with in the
suites
folder and update the test datat-
tab with the test steps. - Or user can proceed with existing postman collection if postman collection already exists.
- In test steps update the
Action
asServiceCall
,Target
asservicename.path
frommodels
,Input
as the API calling methodPOST or GET or PUT or DELETE or any other
andOverrides
column should have values like<endpoint::host::<overridehost>
- Multiple
Overides
can be accepted like<endpoint::host::<overridehost>::protocol::<overrideprotocol>::path::<overridepath>
. - Other way to override is to accept values from environment specific data sheet or default data sheet. Keep the
key-name
as{{keyname}}
and update data sheet with{{keyname}}
and{{keyvalue}}
. Multiple overrides can accepted. - Go to
exmaple_usage/bin
in command prompt and execute asrun.bat <testsuitename.xlsx>
- Verify the logs and extended report for the test results.