httpyac.github.io icon indicating copy to clipboard operation
httpyac.github.io copied to clipboard

How to chain and assert across all chained requests?

Open inakihn opened this issue 1 year ago • 1 comments

Hi,

Thanks for the amazing library, I'm starting to try and use it and I wanted to chain requests while asserting in all requests.

Given those two files, from the examples of the library, where I want to add assertions:

# @name getHttpbinA
GET https://httpbin.org/get?source=getHttpbinA
X-Foo: barA

?? status == 204
# @import ./a.http
###
# @name getHttpbinB
# @ref getHttpbinA
GET https://httpbin.org/get?source=getHttpbinB
X-Foo: barB-{{getHttpbinA.headers["X-Foo"]}}

?? status == 200

I expected that when executing B, the asserts from A would also be executed. But it does not seem to be the case for me. If I put a wrong assert (for example status == 500), B is still shown as executed and passed in vs code.

My goal is to execute a full flow on my application, by composing the different reusable parts of the flow. But I would like to be sure that all imported requests have assertions and have passed.

Does anybody have any hints on this?

inakihn avatar Jul 26 '24 08:07 inakihn

I expected that when executing B, the asserts from A would also be executed. But it does not seem to be the case for me. If I put a wrong assert (for example status == 500), B is still shown as executed and passed in vs code.

The asserts of A get executed, but they are not shown in vscode. If you use CLI you would see the results.. I'll see if I can get the results from A to the corresponding test item, but it might be difficult, as I don't even realize that A is running.

My goal is to execute a full flow on my application, by composing the different reusable parts of the flow. But I would like to be sure that all imported requests have assertions and have passed.

The intended way is actually to simply run all tests in all test files.

AnWeber avatar Aug 03 '24 09:08 AnWeber