MY yaml file from swagger hub contain special parameters according to documentation :
as a part of info object:
info:
description: Test Api
version: "1.0.0"
title: Test API
contact:
email: [[email protected]](mailto:[email protected])
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
#below element
x-filters:
- solution: IRIS
- domain: Clinical
- rdcmLayer: 2
I am unable to wrote test for this paramaeter:
console.log("Start Test");
const jsonData = pm.response.json();
const response = pm.response;
pm.test("Response contain filters/refineers parameters", function() {
pm.expect(response.text()).to.include("x-filters")
});
console.log("Response contain refiners" , jsonData.info.x-filters);
console.log("Finish Test");
In this line:
console.log("Response contain refiners" , jsonData.info.x-filters);
i receive error: /referenceError: filters is not defined, but they are in JSON response:
"x-filters": [
{
"solution": "test"
},
{
"domain": "home"
}
]
Hey @Admin2018131210
You would need to access the property like this as it contains the -
character:
jsonData.info["x-filters"]
I’m not really sure what you’re doing in the test though - What are you trying to assert against?