thunderclient / thunder-client-support

Thunder Client is a lightweight Rest API Client Extension for VS Code.
https://www.thunderclient.com
Other
3.62k stars 127 forks source link

Skipping Tests in Testcollection for CI #1461

Closed erwinmoretz closed 7 months ago

erwinmoretz commented 8 months ago

Question: Hi Ranga,

we implemented a toggle to some features in our service, to turn them on or off. My question is, is it possible to skip some tests in a testcollection?

i tried it with the command, but it doesnt work.

tc.runRequest(null);

Are you using the free version/paid version/trial: paid version

rangav commented 8 months ago

Hi @erwinmoretz

You want to skip requests right?

  1. From Run Collection View Screenshot 2024-01-19 at 09 36 59

https://github.com/rangav/thunder-client-support/releases/tag/v2.15.0


  1. From JS Code
tc.skipRequest("requestId");

https://github.com/rangav/thunder-client-support/releases/tag/v2.16.0

erwinmoretz commented 8 months ago

yes want to skip request.

in my case its the first request, which tests if the toggle is active or inactive. in case of inactive i want to skip, all following testcases in the collection. so there is no requestId which i can write.

Is it possible to stop the runner?

rangav commented 7 months ago

Enable the Stop on fail setting and save it.

Screenshot 2024-01-19 at 10 08 39

When a request test cases fail, it will stop the collection execution and skip remaining requests.

You can also trigger a test fail from the code and stop the runner.

tc.test("custom fail test", false);
erwinmoretz commented 7 months ago

In our case, the test does not fail because I have built a case distinction into the script. Depending on how the parameter is set, other tests are executed. The tests should only stop if the script recognises that the feature switch is switched off.

rangav commented 7 months ago

On what condition you want to stop the runner?

erwinmoretz commented 7 months ago

when the requested status delivers 404 it needs to skip the following testcases in the collection. when the status 200, the runner has to continue.

rangav commented 7 months ago

Then you can check the status code in post req script and then add a custom failed test to stop the runner

rangav commented 7 months ago

Closing this issue, feel free to continue discussion if you have more questions

m3dbedb commented 6 months ago

Where to get request id? Enable the Stop on fail setting and save it. How to save it?