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

Feature Request: custom JS library/module in tests sandbox #153

Closed
bolerio opened this issue Oct 20, 2014 · 15 comments
Closed

Feature Request: custom JS library/module in tests sandbox #153

bolerio opened this issue Oct 20, 2014 · 15 comments

Comments

@bolerio
Copy link

bolerio commented Oct 20, 2014

It would be very useful to develop test verification functions, or more elaborate test fixtures to be made available to tests. Because tests are executed in their own vm sandbox, right now there is no way to pass in global functions/objects. Global variables are limited to JSON, but one wants function. In Postman this is achieved by putting such global functions in a pre-tests sections of an empty test, though that may be just a side-effect of how environments are managed in Postman. In any case, the libraries available by default are great, but one always has some custom code that helps structure larger test suites.

Is this something being considered? Would you be receptive to a pull request implementing such a feature and if so, any opinion on how you would like this done (or how would you not like it done :) ?

@abhijitkane
Copy link
Member

Hi @bolerio,
We're working on a way to use custom JS files in the sandbox, both in Postman and in Newman. Will keep you posted on this.

@bolerio
Copy link
Author

bolerio commented Nov 5, 2014

Thank you. I'd appreciate any updates on that!

On Wed, Nov 5, 2014 at 5:14 AM, Abhijit Kane notifications@github.com
wrote:

Hi @bolerio https://github.com/bolerio,
We're working on a way to use custom JS files in the sandbox, both in
Postman and in Newman. Will keep you posted on this.


Reply to this email directly or view it on GitHub
#153 (comment).

https://plus.google.com/+BorislavIordanov

"Damn! The world is big!"

-- Heleni Daly

@a85 a85 added the feature label Mar 26, 2015
@DaveData
Copy link

+1

We're working with JWT (client generated) tokens. We build and included a lib to handle this, but changes need to be done each time postman has been updated.

Would you prefer a PR with JWT as an auth method like here postmanlabs/postman-app-support#839 ?

@wheelspinner
Copy link

+1
@abhijitkane Any updates on this? Timeline, roadmap, etc? I'm wanting to switch all of our projects to postman and this is a huge need for our very large test suites.

The workaround I've developed adds too many layers of complexity for rapid adoption.

@kurtfm
Copy link

kurtfm commented Mar 22, 2016

Yes! Need this!!! You can push a lib into a global variable but clumsy.

@niraida
Copy link

niraida commented Apr 19, 2016

@abhijitkane are any news about these features?

@wkuckro
Copy link
Contributor

wkuckro commented Sep 26, 2016

This is needed

@kunagpal
Copy link
Member

@wkuckro @niraida @DaveData @wheelspinner @bolerio At the time of writing, the Postman Sandbox supports libraries enumerated here: https://www.getpostman.com/docs/sandbox

Please comment on the specific libraries that you wish to see in future releases of the Sandbox, so the we may plan Sandbox growth better.

@wkuckro
Copy link
Contributor

wkuckro commented Oct 12, 2016

momentJS

@kunagpal
Copy link
Member

@wkuckro Coming soon :) postmanlabs/postman-runtime#92

@kunagpal
Copy link
Member

This is not a part of our current roadmap, but has been marked as a feature request and added to our internal tracker. We'll update this thread when any progress occurs on this. :)

@czardoz czardoz reopened this Oct 29, 2016
@pphelan69
Copy link

pphelan69 commented Jun 19, 2017

Postman/newman was checking all the boxes for rest api automation and then I hit this issue (i.e. not allowing to import custom js) this would be such a useful feature and in my opinion complete Postman.

@kunagpal
Copy link
Member

kunagpal commented Jul 6, 2017

@wkuckro moment-js is available in Neman v3.7.0 and above, you can use it in your test scripts as follows:

var moment = require('moment');

// do stuff here...

@earth2016
Copy link

Hi, Is it going to be possible to add this feature? I think is good to use own libraries to not repeat too much yourself.

@shamasis
Copy link
Member

shamasis commented Jun 5, 2018

Using custom NodeJS modules from NPM is not in near or mid term roadmap. Mostly because the provisioning and security concerns that we need to resolve first. Adding this feature even at Newman and app level will cause workflow issues for majority of people who move between Newman, monitors and the app frequently.

Presently, there are ways around this:

  1. execute repeated code in collection / folder level scripts
  2. use variables to store script and eval them (not recommended though.)

Having said that, we are constantly looking into a seamless way of doing this and we are considering ability to declare script dependencies in collections and so on. So, feel free to +1 the thread mentioned below or add more comments.

Duplicate of: postmanlabs/postman-app-support#1180

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

No branches or pull requests