Sample URL: https://www.w3schools.com/xml/tempconvert.asmx

Sample Request Payload:

<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=”http://www.w3.org/2001/XMLSchema" xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FahrenheitToCelsius xmlns=”https://www.w3schools.com/xml/">
<Fahrenheit>108</Fahrenheit>
</FahrenheitToCelsius>
</soap12:Body>
</soap12:Envelope>

Expected Response:
<?xml version=”1.0" encoding=”utf-8"?>
<soap:Envelope xmlns:soap=”http://www.w3.org/2003/05/soap-envelope" xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=”http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FahrenheitToCelsiusResponse xmlns=”https://www.w3schools.com/xml/">
<FahrenheitToCelsiusResult>42.2222222222222</FahrenheitToCelsiusResult>
</FahrenheitToCelsiusResponse>
</soap:Body>
</soap:Envelope>

Test to add under “Tests” tab of postman:

pm.test(“XML response data value verification”, function () {
var responseData = pm.response.text();

const $ = cheerio.load(responseData, {
ignoreWhitespace: true,
xmlMode: true
});

let FahrenheitToCelsiusResult= $(‘FahrenheitToCelsiusResponse’).find(‘FahrenheitToCelsiusResult’);

pm.expect(FahrenheitToCelsiusResult.text()).to.eql(“42.2222222222222”);

});

More info on Cherrio: https://github.com/cheeriojs/cheerio

Did you know that following keywords are interchangeable in cucumber, but should be better use depending on the context of your flow?

Feature | Ability | Business Need
Scenario Outline | Scenario Template:
Examples | Scenarios

#bdd #cucumber #syntax #keywords #tips #automation #gherkin

We get a lot of use cases where we may have to implement Base64 encoding and/or decoding while building our APIs. And, if you are wondering if it is possible to encode/decode the variable/response using Postman itself or how to encode/decode the token or password in postman and save it in a variable?

To Base64 encode/decode, the quickest way is to use JavaScript methods btoa, atob:

  • atob — It turns base64-encoded ASCII data back to binary.
  • btoa — It turns binary data to base64-encoded ASCII.

Sample code:

var responseBody = pm.response.json();

var parsedPwd = JSON.parse(atob(responseBody.password)); // presuming password is in the payload

pm.collectionVariables.set(“password”, parsedPwd);

You have a set of BDD feature files written in the Gherkin language but your stakeholders doesn’t really like the text-only format? Plus they don’t want to open each feature file by one by one to go through it? Start using Pickles, it generates a document containing all features in a single documentation in just one step and it’s an opensource too.

Pickles has a lot of other ways and parameters, do checkout more details here: http://docs.picklesdoc.com/en/latest/, https://github.com/picklesdoc/pickles and https://www.picklesdoc.com/#

P.S. It can generate your documentation in a variety of formats like JSON, Excel, Word, etc. and not only HTML.

#pickles #gherkin #bddAutomation

Pickles

In Azure DevOps, if you don’t want JUnit Test results and like to have a HTML Report (htmlextra) that newman provides which is very neat and comprehensive, go for this FREE extension: https://marketplace.visualstudio.com/items?itemName=MaciejMaciejewski.postman-report

This lets you create a task for publishing newman HTML Reports in your pipeline into Azure Storage(like shown below in Image 1). And then, embedded reports can be viewed as a tab in Build and Release result page (like shown below in Image 2). Plus, there is an option to download the reports from the same tab.

Dheeraj Gambhir

I’m weird. I’m a weirdo.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store