How to set up @ref/@forceRef dependency correctly? #299
Replies: 3 comments 2 replies
-
depending on the context.
I did not consider resetting the environment and it is not currently implemented. It could be done manually now, because you can simply trigger the execute the other request using script. But it doesn't feel good. That might be a feature.
Yes would be possible. vscode has an API for this. |
Beta Was this translation helpful? Give feedback.
-
I will change the name in the comment (didn't think abou the implicit |
Beta Was this translation helpful? Give feedback.
-
I edited my summary, so when you get a chance to verify, please comment if I got it right or not (no rush). Yes, ability to reset environment on every run and/or clear all outputs would be wonderful. I am currently testing APIs from several vendors, and they do not always work as expected. So, my curent workflow is:
It would be helpful to not have to repeat the clear steps every time. This could be governed by settings. Another improvements would be some sort of separators in the output windows to indicate beginning and end of each test run because as of now, it's very hard to find where the previous test run ended and the last one began. And a very minor improvement would be to mark the skipped requests that met the disabled/cancelled criteria in the request output window. You can figure out which steps were skipped in the other output windows, but the request output does not mention them at all, which makes it a bit confusing for a novice (at this point, I think I have an idea why they get skipped but I was struggling with it for the past couple of weeks). And another monor improvement would be to clear response tab before each run. I use a single response output file/tab because dealing with many response files is cumbersome, and it shows the output of the last invoked reponse, which is fine, but if the last request did not run (it was disabled or cancelled), then it still shows output from the last run giving an impression that a request was made, when it wasn't. It bit me a few times before I realized the behavior. |
Beta Was this translation helpful? Give feedback.
-
I am trying to understand the explanation at https://httpyac.github.io/guide/metaData.html#ref-and-forceref ("forceRef always call the other request. ref only calls if no response is cached"), but I cannot find the description of "cached". Are responses cached for each run (by run, I mean executing a single request, multiple requests, a file, a folder, or multiple folders)? Or are they cached until you reset the environment?
I am trying to figure out how to correctly set up dependencies between requests. Say, requests
X
,Y
, andZ
depend on requestA
. I can run requestsX
,Y
, andZ
individually or as a group, but regardless of how I run them, I need requestA
to be executed only once (during each run). So, the run sequences could be:It should NOT be:
I thought that
@ref
would do this, but if I used@ref A
and runX
only,A
does not get executed (I need to explicitly include bothA
andX
in the run) unless I reset the environment. If I use@forceRef A
, then runningX
,Y
, orZ
will first executeA
, but if I run a combination ofX
,Y
, andZ
, thenA
seems to get invoked for each one of them, and I do not want this (think of test dependency whenA
creates a new item andX
,Y
, andZ
do various operations on it, such asGET
,PATCH
,DELETE
).Could you clarify how this works and what I need to do to set up a dependency for each test run? If caching is set for the lifetime of the environment until I manually reset it, is there a way to configure it to have caching only valid for a test run (again, a test run means a run of a single test or multiple tests)? Or maybe there is some other way to clear cache before each run? Programmatically?
And while we're at it, is there a way to clear all output windows (httpac - Log, httpyac - console, httpyac - Request, and possibly response and variables tabs) before each run? It's a bit tedious to clear them manually and if I do not then the outputs intermingle with the outputs from the previous runs and since there are no separators between them, it is hard to see what happened when.
Beta Was this translation helpful? Give feedback.
All reactions