I’ve been using newman to do some automation, but I’m now beginning to hit a wall when I use it with node.js. Here’s the node.js code
const newman = require('newman');
newman.run({
collection: require('./my.json'),
iterationData: require('./my.csv'),
iterations: 5,
reporters: 'cli'
}).on('beforeRequest', function (error, args) {
if (error) {
console.error(error);
} else {
// Log the request body
console.log(args.request.body.raw);
}
}).on('request', function (error, args) {
if (error) {
console.error(error);
}
else {
// Log the response body
console.log(args.response.stream.toString());
}
});
When I run this code, it cannot process the URL which includes a variable with double curly braces, i.e. http://myserver/{{variable}}
When I run node.js with a the above javascript. I get
ReferenceError: variable is not defined
it’s not a parameter, so it’s not a key-value pair.
Thoughts?