testFunction bodies are sent directly to Postman for execution. However Postman doesn't support using custom functions or libraries out of these testFunction bodies scopes.
We may expand these functions in testFunctions. This concept is coming from lisp macros.
For example the test below should print 3 when given to jetman.execute method:
function helperA(){
x = 1;
}
function helperB(){
helperA();
y = 2;
}
function testFunction(){
helperB();
z = x + y;
console.log(z);
}
request = {
'name': 'Root endpoint works'
'url': 'localhost:9090'
}
exports.run = function() {
jetman.send(request, testFunction);
}
This could be achieved if the called functions in testFunction are expanded recursively beforehand. Then we can pass the following body to Postman after expansion:
{
{
x = 1;
}
y = 2;
}
z = x + y;
console.log(z);
This feature could be applied to external JS libraries too. Interest for such a feature is already expressed here: postmanlabs/newman#153
testFunctionbodies are sent directly to Postman for execution. However Postman doesn't support using custom functions or libraries out of thesetestFunctionbodies scopes.We may expand these functions in testFunctions. This concept is coming from lisp macros.
For example the test below should print
3when given tojetman.executemethod:This could be achieved if the called functions in
testFunctionare expanded recursively beforehand. Then we can pass the following body to Postman after expansion:This feature could be applied to external JS libraries too. Interest for such a feature is already expressed here: postmanlabs/newman#153