Skip to content

Postman Integration and Overrides

Jayachandra37795448 edited this page Jan 15, 2019 · 25 revisions

This page will give you the understanding and implementation of postman collection for API testing.

Using postman collection for API testing :

  • Create an API postman collection in standard format of postman. 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 data t- tab with the test steps.
  • In test steps update the Action as ServiceCall, Target as servicename.path from models, Input as the API calling method POST 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 as run.bat <testsuitename.xlsx>
  • Verify the logs and extended report for the test results.

Overriding or assigning values for variable in postman collection (set request body):

This feature can be used to arsetest data based on environment (Dev/Prod).

  • 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 data t- tab with the test steps.
  • In test steps update the Action as ServiceCall, Target as servicename.path from models, Input as the API calling method POST or GET or PUT or DELETE or any other and Overrides 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 as run.bat <testsuitename.xlsx>
  • Verify the logs and extended report for the test results.

Override the API endpoint for postman and swagger (set endpoint):

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 data t- tab with the test steps.
  • Or user can proceed with existing postman collection if postman collection already exists.
  • In test steps update the Action as ServiceCall, Target as servicename.path from models, Input as the API calling method POST or GET or PUT or DELETE or any other and Overrides 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 as run.bat <testsuitename.xlsx>
  • Verify the logs and extended report for the test results.