This repository contains a series of Postman collections that can be triggered using Newman in a Jenkins pipeline. The collections are designed to be used for testing different environments and have separate branches aligned to each environment.
The repository consists of the following branches, each aligned to a different test environment:
foo
(Production Environment)foo-dev
(Development Environment)foo-uat
(User Acceptance Testing Environment)foo-sap
(SAP Integration Environment)
To update the Postman collections, follow these steps:
- Clone the repository locally:
git clone <repository_url>
. - Switch to the branch representing the desired environment:
git checkout <branch_name>
. - Make the necessary changes to the Postman collection using the Postman desktop application or the Postman API.
- Export the updated collection as a JSON file and replace the existing collection in the repository.
- Commit and push the changes to the repository.
Note: It's important to ensure that no sensitive information, such as passwords, is included in the Postman collections or any other public documents.
Each branch in the repository contains an env-vars.json
file specific to the corresponding environment. This file should include environment-specific variables required for running the Postman collections.
To update the env-vars.json
file, follow these guidelines:
- Use variable names that are self-descriptive and meaningful.
- Avoid hard-coding any environment-specific values in the
env-vars.json
file. - Reference the variables stored in the global var files stored in Jenkins for credentials or sensitive information.
- For local execution and testing purposes, you can utilize Postman's local/global variables.
Note: Ensure that all credential mappings in the env-vars.json
file reference the variables stored in the global var files stored in Jenkins. This helps maintain security and prevents sensitive information from being exposed in the repository.
To verify the tests locally, follow these steps:
- Ensure that you have Postman installed on your local machine.
- Clone the repository locally:
git clone <repository_url>
. - Switch to the branch representing the desired environment:
git checkout <branch_name>
. - Open Postman and import the Postman collection JSON file from the cloned repository.
- Set the required environment variables in Postman using the
env-vars.json
file. - Execute the individual requests within the collection to verify their functionality.
Note: Avoid hard-referencing any URIs or specific endpoints in the tests. This ensures that the tests remain flexible and can be easily adapted to different endpoints or environments.
For longer running tasks or tests, it is recommended to refer to existing tests within the repository. These tests may provide guidance on how to manage tasks that take a considerable amount of time to complete.
To refer to existing tests, follow these steps:
- Open the Postman collection in the repository using the Postman desktop application.
- Navigate to the specific test or request that demonstrates the management of longer running tasks.
- Review the test documentation and associated scripts to understand the approach taken.
- Apply the relevant strategies and techniques to manage longer running tasks in your own tests.
Remember to document any additional information or considerations specific to your tests and update the README.md
file accordingly.