usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.34k stars 1.16k forks source link

New Feature: Post Pesponse for both "before request" and "after request" #2680

Open tho-gru-38 opened 1 month ago

tho-gru-38 commented 1 month ago

I have checked the following:

Describe the feature you want to add

Hi,

I have read https://github.com/usebruno/bruno/issues/2597 which clarified the situation of execution sequence of scripts at different levels: collection folder, request.

Unfortunately the current sandwich flow almost make it impossible to import a Postman collection without massive changes. All tests at collection or folder level must be duplicated to the requests. Doing so will result in a working but unmaintainable collection.

So I want to get a separation of "Post Response" and "Tests" in to different sections: before request and after request

Following my idea will meet all requirements:

  1. Easier import collections from Postman
  2. Fulfill the wishes of the users who voted for the sandwich flow

------------ insertion on 20240723 start The reason for having both "before request" and "after request" is that i plan:

  1. providing function definitions for all requests used in der prost response and tests section
  2. Based on the result of the response I can implement a conditional workflow easier when scripts are also executed after the response (as described in https://github.com/usebruno/bruno/issues/1100) ------------ insertion on 20240723 end

The following diagram illustrates the execution sequence:

Execution-Sequence-01 drawio

Kind regards Thomas

Mockups or Images of the feature

For Folder an Collections the dialog can look like these: Folder-Scripts Folder-Tests

Its-treason commented 1 month ago

I feel like this would overcomplicate things. The better (and already planned) solution was to have a toggle Sandwich & natural flow on collection level: #2639

tho-gru-38 commented 1 month ago

Hi @Its-treason,

thanks for your reply.

I rethink my feature request and edited it.

The advantage of having both also is that at collection/folder level I can define generally used functions on one hand and on the other the after having the response at collection/folder level I can decide how to continue with the conditional workflow.

Kind Regards Thomas