-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Feat: Skip request #2397
base: main
Are you sure you want to change the base?
Feat: Skip request #2397
Conversation
I would probably omit this |
Hey @JorgeTrovisco, thanks for creating this PR. I will test it and get back to you soon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked out your branch locally and run into this issue if I try to use the new function:
Same thing happens if I remove the if before the skip condition, but doesn't happen if I remove the skip function call. Did I do it wrong? If yes I would recommend to implement some intuitive error handling
if (type === 'request-skipped') { | ||
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); | ||
item.status = 'skipped'; | ||
item.responseReceived = action.payload.responseReceived; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason item.responseReceived
is set here?
Seems like a copy paste mistake but I could be wrong.
I would expect action.payload.responseReceived
to be undefined when the request is skipped so item.responseReceived
would be as well?
Also why are we using .find()
here, whereas all the other types use .findLast()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for your fast reply! Looks very good (on code level)
So have you been able to reproduce my error or do I need to set up some collection to reproduce the error?
Or did I use the function not as intended?
Shouldn't it be also implemented for bruno-cli ? |
So this is the smallest reproducible example I was able to build: example.bru
For reproduction it is the easiest to set up a new ENV with the var |
The skip request is just for collection running, so when you execute the request manually it should still be executed. It works without the creation of the environment variables? Is the error related with trying to get a unavailable variable? |
|
What you are saying is actually a very valid point. I think to break it down, there are two different requirements behind it. Your Requirement: (I suppose)
My Requirement:
However, honestly, I feel like the implementation you did with the
In any case we both agree, that, if you execute a single request which is using the Does this make sense? Do you agree? Thank you so much already for all your efforts, I really appreciate your work! |
I opened a new feature request for this #3005 and a pull request #3006 Would really appreciate if we could get this PR merged, is there anything I could do to help you with the implementation? I am also not too familiar with the codebase, but in case you are stuck with something we might be able to figure out together. |
it's a bit related to that but I'm looking to add preconfigure scenarios for run feature. |
As I understand your PR, it's only for CLI? Generally speaking as mentioned earlier there are two ways of how to manage selective runs:
Honestly, both have their benefits, however, I pretty like the idea of a skip condition in any case. I personally would most likely implement skip conditions for any variable not set to avoid spamming my server with malformed requests (which might generate unnecessary error logs). |
Yes it's only for cli now and if it get merged I'll add ui to configure and run it. It's more to configure scenarios for integration test that are saved inside collections. I just mentioned it for visibility and because it could be useful in those case. But yeah skipping is needed too |
I close this PR because we need to break it down in smaller features to comply with "The pull request only addresses one issue or adds one feature."
I would appreciate if we could discuss the best approach before implementation, so that we don't need to refactor this code once more after the new implementation |
Bummer my requirement was only to skip with some logic in the pre script within runner |
I created a PR for this feature, extracted and modified from this PR. Would be happy if you would review #3105 and would be cool to get this merged. For my understanding we could keep this PR reopened and address
with it. My expectations would be like this:
Feel free to add some more expectations. I feel like this PR was really close already. |
I will maintain this PR open expecting the completion of yours. Meanwhile I will:
@ben-sai this approach will be much better because is able to address what everyone needs. (Both skipping in runner only, everywhere and conditionally base on any variable) |
I think that is good at this point
Is there any guide like https://github.com/usebruno/bruno/blob/main/contributing.md to run the CLI version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested in cli but in UI it works very well for both runner and single request, thank you so much!
Thank you for your work on this! This feature is essential for our current project. Implementing this functionality will greatly enhance endpoint testing, and I believe many other users will benefit from it as well |
Hi! When this future will be available? |
Description
Adds the feature mentioned on #2116. This functionality is important because some endpoints cannot be tested recurrently when we invoke complex APIs. This way we can keep these endpoints in the collection with examples and documentation without running the risk of invoking them in the collection run.
Contribution Checklist:
Screenshots