postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.83k stars 838 forks source link

Reuse the same request inside several collections #1535

Open KumG opened 8 years ago

KumG commented 8 years ago

Is there a way to reuse the same request in several collections ? I didn't find how.

For example, I need to call a login method before any other method call, and I want my collections of tests to be independent. If I duplicate the login request, I will have to edit all the requests if I need to change something.

abhijitkane commented 8 years ago

This is currently not supported. You can use environment variables (https://www.getpostman.com/docs/environments) so that you don't have to change each login request. Just changing the environment variables will do.

kurtfm commented 8 years ago

I think it would be nice to have something like a linked test. Right now if I need to chain a certain test before other tests in multiple places (say to get a unique id before updating or deleting) I have to duplicate the test. Then if I realize I have an issue in the pre or post logic I need to go through and clean each one individually.

stephenliberty commented 8 years ago

I'm +1'ing - ran into this problem as well. If an endpoint changes, or a step needs to be added (like pulling more details out of a login response), it needs to be done on every request. Not exactly great..

andy-cam commented 8 years ago

+1 for this, our use case requires several steps along a user journey before certain calls will function as expected, and we don't want to litter collections with duplicate, unlinked requests. Global (or superclass-like) tests that can be referenced in collections rather than duplicated would be very powerful!

GabbyChangSH commented 8 years ago

+1 And does there any other workaround to solve these problem? @abhijitkane, how to add one request in the environment variable? Can you give one example?

ebelanger commented 8 years ago

+1 - this is especially true when collections are used for test automation with newman. I can understand that it may not be a priority from the postman UI, but the value of reusable parts in tests has been proven times and times again.

rapidroamer commented 8 years ago

+1

JohnArrowwood commented 8 years ago

+1 I don't just want to re-use the URL. I need to re-use the whole request. The pre-request script. The request body, where appropriate. The request method. Everything. It might be nice to have custom post-tests. But if we can't do that, I can live without it.

satbirbains commented 7 years ago

If each collection is treated as an independent flow of requests of which all require their own login, then setting an environment variable is not suitable. Currently the only option is to duplicate the login request in every collection, the more requests that need to be shared the worse the situation will become.

With newman we can automate the process of running collections and as such also run them concurrently making this a must have feature for test automation and make this a much more powerful tool!

gianisegatto commented 7 years ago

+1

ohitsdaniel commented 7 years ago

+1

ahilsend commented 7 years ago

+1

Maybe something like a set of request definitions (probably parametrized through env).

And a "test definition" could take several such definitions, and a list in which sequence to execute those. This way requests could be shared across test runs, and one test run could run the same request twice if needed.

sd-bnguyen commented 7 years ago

+1

steher commented 7 years ago

+1

sowjanyaqsg commented 7 years ago

+1

Workom2016 commented 7 years ago

+1

Please let us know when such ability will be available.

sdnts commented 7 years ago

Guys, we're working on collection level scripts, which I believe should solve all your issues. Will let you know here when we make progress :)

juniorplenty commented 7 years ago

+1

jlundy2 commented 7 years ago

+1

LolaYan commented 7 years ago

+1

brian-prince commented 7 years ago

+1

stephan-simondshealth-com-au commented 7 years ago

+1

arpadffy commented 7 years ago

This is a highly desired feature. It would allow writing complex test sequences based on a common API call library. Hope this feature will come soon.

+1

brianpburns commented 7 years ago

+1

MBurchard commented 7 years ago

+1

RichardForshaw commented 7 years ago

+1

As a suggestion, perhaps providing a synchronous way to execute another script by name in a pre-request script, such as postman.executeRequest(RequestName)? (Or even better a collection name).

This would allow common setup to take place for collections.

Thanks for the great tool so far!

toolmania1 commented 6 years ago

+1

codynolf-legacy commented 6 years ago

+1 I would like to do this as well. If changes are required we need to update multiple places.

Thanks, Cody

testmonger commented 6 years ago

scalability and maintenance--hello? it just makes sense to be able to re-use request and test items, especially when they are parameterized.

rsaa commented 6 years ago

+1

satbirbains commented 6 years ago

Two years guys.. time to move on I think, it doesn't look like test automation is the focus. The importance and benefit this would have brought has been missed which is a shame.

MBurchard commented 6 years ago

I'm sorry to say this, but it turned out that Postman is unsuitable, as it is implemented now. Even the Pro version has no advantages. Postman's not evolving. This tool looks great. It is easy to use, but it's not enough for productive use. You can't reuse modelled requests properly again. You cannot use different test data in the form of CSV files for every request. Iterations are only valid for entire collections or subfolders. We use the ugly old JMeter and now we're looking at what can be achieved with JMeter and Blazemeter.

skyboyer commented 6 years ago

When I export collection I can see each collection has it's own unique _postman_id. Once request gets its unique id too it would be easier to implement "linking" or "referencing" to shared request.

pprogrammingg commented 6 years ago

+1 this is a desirable feature and if added it can help us move from SOAP UI project.

rgranadino commented 6 years ago

1+ for this, I was hoping the "Runner" functionality to work similar to SoapUI's Test Case functionality. ☹️ In SoapUI one defines the end points, create a test case which defines which requests are to be tested and what order they're in (+transferring data between requests and assertions).

Ne4istb commented 6 years ago

+1

Rashmi-Nuviso commented 6 years ago

+1 , can postman team prioritize this enhancement ??

rvdwijngaard commented 6 years ago

+1

yeugeneu commented 6 years ago

definitely +1 to this!!

emypenguin87 commented 6 years ago

Really need this feature +1

philld-4L commented 6 years ago

+1

This feature would be the difference between having a proof of concept and an enterprise solution. It would significantly reduce the maintenance overhead and finally put code-heavy solutions for service testing to bed.

rolfmadsen commented 6 years ago

+1

Clicketyclick commented 6 years ago

+1

DDBdrift commented 6 years ago

+1

cmjchrisjones commented 6 years ago

+1

tb2186 commented 6 years ago

I just started using Postman in earnest and I thought it was just my imagination but it seems like once a request is added to a collection it becomes unique to that collection and if you ever need to edit all of the same request types you need to edit each of the individual instances in every collection it appears in.

It just seems insanely odd to me that the requests can't be maintained in one place and referenced across collections. That idea is computer science 101 and has been around for what - 50 years? This simply isn't viable.

JohnArrowwood commented 6 years ago

Amen. But if only it were that simple to implement. So I get why it isn't there yet. But yes, Postman would be a serious contender if it could do that.

On Fri, Mar 9, 2018 at 1:00 PM, tb2186 notifications@github.com wrote:

I just started using Postman in earnest and I thought it was just my imagination but it seems like once a request is added to a collection it becomes unique to that collections and if you ever need to edit all of the same request types you need to edit each of the individual instances in every collections it appears in.

It just seems insanely odd to me that the requests can't be maintained in one place and referenced across collections. That idea is computer science 101 and has been around for what - 50 years? This simply isn't viable.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/postmanlabs/postman-app-support/issues/1535#issuecomment-371894048, or mute the thread https://github.com/notifications/unsubscribe-auth/AHd1xf3_SxOf5v8zrnMR8N0HVk16Zhnmks5tcsNSgaJpZM4GYAD- .

-- John Arrowwood

kinlane commented 6 years ago

+1

bordigoni commented 6 years ago

+1

jnfsmile commented 6 years ago

+1