Skip Single Request
I have checked the following:
- [X] I've searched existing issues and found nothing related to my issue.
Describe the feature you want to add
The new request skipping implemented with #3719 is great! This really adds a lot of value to Bruno for me personally.
I implemented the new bru.runner.skipRequest() conditionally in most of my collection already and it generally works well. Thank you so much for that. However, as mentioned in #2397 already, it would be great to also skip Single Request. This helps both, to check if the skipping script works and to avoid unexpected errors.
I personally would have preferred to keep the request skipping generic (and not bound to the runner), and if someone would want to skip only runner requests, this could be done using #3200:
if(bru.getExecutionMode() === 'runner'){
req.skip();
}
Mockups or Images of the feature
Implement new req.skip(); to skip both runner and single requests.
Just wanted to mention here that we see a couple of issue with the runner.skipRequest() function in our collection run:
- when run, not only the current request is skipped, but all the remaining tests.
- the Junit summary report does not indicate any skipped requests
Our use case is:
- In our CICD automated process, we run a single collection of tests in either dev, test or production env.
- The collection consists of 79 regression tests (requests)
- The collection test run is kicked off from a github action, which means that it uses CLI + bail (since we want to fail if any of the regression tests fail).
- A few test cases are not possible to run in test or production (only possible in dev), due to AS2 certificate configurations. We therefore programmatically check the environment (dev/test/prod) and if not dev, we skip the request using bru.runner.skipRequest().
Less of a problem, but just wanted to mention the jUnit summary as well: We see the following for a run in DEV Execution result: Requests: 79 passed, 79 total JUnit Test Report: 153 tests run, 153 passed, 0 skipped, 0 failed.
And the following for a run in TEST Execution result: Requests: 72 passed, 1 skipped, 73 total JUnit Test Report: 144 tests run, 144 passed, 0 skipped, 0 failed.
The repro steps would be: a) Create a collection with 3 test requests b) Configure request number 2: "if varX = skip, then skipRequest()" in pre-script. c) Run from CLI with --bail option and varX = whatever d) Run from CLI with --bail option and varX = skip
Using the latest bruno cli using "npm install @usebruno/cli -g"
Yes, skip request in the runner implies the request doesnt get called as tests are run after the request run all these tests will be skipped
Currently as we generate the JUnit report in the testSuite is added skipped property with a count if the request is skipped. Is this information not sufficient? May I know which report viewer are you using?
We're using the mikepenz/action-junit-report@v4 viewer but that is a minor issue (not being reported there).
Since we're running 100's of independent regression tests (in a single Collection) using this approach, it would make much more sense if we can bypass a few of them when necessary for above reason. The documentation (https://[docs.usebruno.com/testing/script/javascript-reference#skiprequest) states that it should skip the current request and not stop the whole collection run. There is another stopExecution() command for that purpose (terminating the collection run).
Regards /Hakan Hansson
Hi @hakanhansson-ica I think there’s a bit of a misunderstanding — what I meant is that when you skip a request, the tests associated with that request is also skipped. Skipping a request doesn’t stop the entire collection run.
Thanks @anusreesubash for your reply. Yes, you can ignore this, since it works as expected now. I think the underlying problem was that the skipRequest() was earlier treated as a failure when using --bail option under CLI, and that issue was resolved after I posted my original message. Refer to https://github.com/usebruno/bruno/issues/4155
I just verified in our environment and all seems ok here. Thanks again.
Thanks for confirming @hakanhansson-ica
@anusree-bruno please reopen the ticket, the original ticket intent was not related to the issue mentioned.
@nikischin Thanks for pointing out. May I know why you want to skip a request outside the runner context?
@anusree-bruno there are preconditions that needs to be met in order to make a request useful. This could be a successful login and all variables set.
If there are not all variables set I really don't understand why Bruno would still trigger the request with placeholders. This just does not make sense. I cannot expect a request with a placeholder to have a useful response. Therefore I would want to skip this request in both runner and single request environment.