Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand functions inside testFunctions #6

Open
hantuzun opened this issue May 24, 2016 · 0 comments
Open

Expand functions inside testFunctions #6

hantuzun opened this issue May 24, 2016 · 0 comments

Comments

@hantuzun
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant