Kategorien
Allgemein

Spreadsheets to create test execution commands

In one of my current projects, I’m using Postman to check an API product which is used by multiple clients, where each client has its own URL and specific test data to be used.
It’s about a dozen postman collections (each modelling one specific use case), and those need to be tested for about 20 different clients (number is constantly growing).

For execution in our continuous integration server, we’re using Newman (the Postman command line runner). You install the newman npm package, export the collections and environment files from Postman to your hard disk, and then can run the postman checks on your command line, or on a CI system.

A Newman command basically looks like this: newman run "collection.postman_collection.json" -e "environment.postman_environment.json"

So telling newman to run the collection collection.postman_collection.json using the data from the environment file environment.postman_environment.json.
Pretty simple and straightforward.

But remember, I need this for about 12 collections for 20 different clients. Also, each client has a sandbox, user acceptance test and production environments. In addition, the commands are slightly different in my local Windows machine, compared to the CI server, which is running on Linux.
12 collections x 20 clients x 3 environments x 2 operating systems = 1,440 commands to be written!
That’s quite a lot!

So I’m using a spreadsheet to generate the commands, since this is something that can be done pretty easily with formulas. A simplified version of my spreadsheet looks like the following:

  • Column A holds the name of the collections (without the “.postman_collection.json” extension)
  • Row 1 holds the name of the postman environments (without the “.postman_environment.json” extension)

The formula in cell B2 is ="newman run """&$A2&".postman_collection.json"" -e """&B$1&".postman_environment.json""", which is the very same as the basic Newman command I explained earlier, but it is pulling the value for the collection from cell A2, and the value for the environment from cell B1.
The $ signs are telling the spreadsheet, to not change the value followed by it, when extending the formula to other cells. When extending the formula to cell C2, we still want to get the value from A2 as the environment.
I then can easily copy the commands from the spreadsheet and paste them into my command line window or wherever I need them.
The example spreadsheet is available here: Spreadsheets to create test execution commands

Hope that this might help anyone out there to maybe save some manual work and would be interested to hear how you are using spreadsheets to ease your lifeas a tester (besides from putting your test cases in there).

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.