15 Days of Postman for Testers Challenge — Day 02: Version Control

Lakshmi Nandakumar
Women in Technology
6 min readDec 25, 2023

Just like Github or Gitlab or any other version control systems, Postman also allows version control. You can create a pull request to merge any of your changes to the parent collection. If you own both the parent and the forked collection, you can simply merge the changes without creating a PR. This challenge explores merging your local changes to the parent collection.

Photo by Rubaitul Azad on Unsplash Edited by Lakshmi Nandakumar

Initial Setup:

  • Fork the Parent Collection: To fork a collection
  1. Go to the 15 days of Postman — for testers public workspace
  2. Hover over the collection — Day 02: Version control > click on ellipses … (view more actions)
  3. Choose Create a fork
  4. Give the fork a name, choose the public workspace in which you’re working on these challenges
  5. Click Fork Collection

Steps of the Challenge with Solution:

  • Step 1 — Fork the collection (again): Fork the collection again within the workspace and label the fork feature-branch, so that you have 2 collections named Day 02: Version control

Solution:

  1. In your public workspace, hover over the collection — Day 02: Version control > click on ellipses … (view more actions)
  2. Choose Create a fork
  3. Give the fork a name, choose the public workspace in which you’re working on these challenges
  4. Click Fork Collection

You should now have 2 collections called Day 02: Version control in your workspace

Screenshot by Lakshmi Nandakumar
  • Step 2— Add a request: In the feature-branch collection, add a request to the folder Version control called New Request with the following details

1. POST method

2. {{baseURL}}/post request URL

Screenshot by Lakshmi Nandakumar
  • Step 3— Include a body: Under the Body tab, update the body type to raw and in the dropdown at the end where it says “Text”, select JSON. Add a JSON object like the following
{
"data": "noodles"
}
Screenshot by Lakshmi Nandakumar
  • Step 4 — Add an environment: Create a new environment called myEnvironment, with a key baseURL and value https://postman-echo.com. Then select the environment as the active environment. Send the request and confirm a 200 status is returned

Solution:

  1. Click on Environments on the left hand context bar
  2. Click the ‘+’ (Create new environment) on the top left next to the context bar
  3. Name the environment myEnvironment
  4. Add a variable called baseURL
  5. Add it’s current value https://postman-echo.com
  • Step 5 — Merge changes: Since you are the author of both forks, you have permissions to merge any changes. Merge your changes from the feature-branch into your own parent collection.

Solution:

  1. Hover over the collection — Day 02: Version control (feature-branch) > click on ellipses … (view more actions)
  2. Choose Merge changes
  3. Make sure the destination is Day 02: Version control (<your fork>)
  4. Click Merge All Changes
Screenshot by Lakshmi Nandakumar
  • Step 6 — Submit your solution: There are three parts to submitting the solution for this challenge. You have to submit the first & second collections and the environment.

Solution:

The following steps are performed to submit the first collection:

Get the collection ID: Select the collection in the sidebar. Then the context bar to the right, select the Info icon and copy the collection ID.

  1. Click on Day 02: Version control (<your fork>) collection on the left hand collection list
  2. Click on the i icon on the right hand context bar
  3. Copy the collection ID

Update the request URL: Update the {{collection_uid}} in the request URL with the collection ID.

There are 2 ways of updating the request URL

  1. Replace {{collection_uid}} in the URL with the Collection ID copied in the previous step or…
  2. Hover over {{collection_uid}} > Add new variable > paste the collection ID copied from the previous step in the Value field > Choose the correct collection as the scope > Click Set Variable

Get your Postman API key: Create an environment variable called postman_api_key, then get the Postman API key and assign it as the value for postman_api_key.

  1. Go to Manage accounts > Settings
  2. Click on API keys
  3. Copy the API key if there is one, otherwise, generate one first.
  4. Click on Environments on the left hand context bar > select myEnvironment
  5. Add a new variable called postman_api_key and paste the API key as it’s initial and current value.

This will create an environment variable called postman_api_key which can be used in the rest of the challenges too.

Validate your solution: Click Send and look under the Tests tab of the server response at the bottom to review your test results. The HTTP status code should be 200 and all the tests should pass for successful completion of the challenge.

Screenshot by Lakshmi Nandakumar

The following steps are performed to submit the second collection:

Get the collection ID: Select the collection in the sidebar. Then the context bar to the right, select the Info icon and copy the collection ID.

  1. Click on Day 02: Version control (feature-branch) collection on the left hand collection list
  2. Click on the i icon on the right hand context bar
  3. Copy the collection ID

Update the request URL: Update the {{collection_uid}} in the request URL with the collection ID.

There are 2 ways of updating the request URL

  1. Replace {{collection_uid}} in the URL with the Collection ID copied in the previous step or…
  2. Hover over {{collection_uid}} > Add new variable > paste the collection ID copied from the previous step in the Value field > Choose the correct collection as the scope > Click Set Variable

Validate your solution: Click Send and look under the Tests tab of the server response at the bottom to review your test results. The HTTP status code should be 200 and all the tests should pass for successful completion of the challenge.

Screenshot by Lakshmi Nandakumar

The following steps are performed to submit the environment:

Get the environment ID: Select the environment in the sidebar. Then the context bar to the right, select the Info icon and copy the environment ID.

  1. Click on Environments on the left hand context bar
  2. Select myEnvironment
  3. Click on the i icon on the right hand context bar
  4. Copy the environment ID

Update the request URL: Update the {{environment_uid}} in the request URL with the environment ID.

There are 2 ways of updating the request URL

  1. Replace {{environment_uid}} in the URL with the environment ID copied in the previous step or…
  2. Hover over {{environment_uid}} > Add new variable > paste the environment ID copied from the previous step in the Value field > Choose the correct environment as the scope > Click Set Variable

Validate your solution: Click Send and look under the Tests tab of the server response at the bottom to review your test results. The HTTP status code should be 200 and all the tests should pass for successful completion of the challenge.

Screenshot by Lakshmi Nandakumar

I hope this article has helped you solve the second challenge.

Thanks for reading!

--

--

Lakshmi Nandakumar
Women in Technology

Senior QA Engineer | SDET | Quality Engineering Enthusiast! | Voracious reader | Neurodivergent | Applitools Ambassador | GirlCode Ambassador/Mentor