Skip to content

Big problem with v6.16.2 (MUST REVERT) #336

@alekdavis

Description

@alekdavis

I think we got a big problem with the v6.16.2 update.

Here is the scenario:

Testing a CRUD sequence. POST successfully creates an object, but some assertion fails (maybe some property is not quite correct, or the Location header is missing, something not essential, but causing the test to fail). There is a number of tests depending on the POST: GET, PATCH, GET after PATCH, and finally DELETE. Most of them have a @ref to the original POST. But since the response variable gets cleared, for every test with the POST test dependency, POST will be called again and again. This is really bad.

Try this sample:

### Test A
# @name a
POST https://httpbin.org/anything

?? status == 200
?? body json exists

### Test B
# @name b
# @ref a
{{
  exports.$cancel = !(aResponse.statusCode == 200);
}}
GET https://httpbin.org/anything

?? status == 200

### Test C
# @name c
# @ref a
{{
  exports.$cancel = !(aResponse.statusCode == 200);
}}
PATCH https://httpbin.org/anything

?? status == 200

### Test Z
# @name z
# @ref a
{{
  exports.$cancel = !(aResponse.statusCode == 200);
}}
DELETE https://httpbin.org/anything

?? status == 200

You see how a failed assertion in referenced tests essentially turns @ref into @forcedRef?

Not only that. Now there is absolutely no way to reference a response from a request with a failed assertion. The request could've been good and an assertion could be minor, but since assertion failed, any test referencing it will be automatically skipped. Meaning, any failed assertion after a successful POST will not allow to DELETE the object.

We definitely do not want that. And I do not think there is a way to fix it.

I think the original behavior made more sense. A request with @ref or @forceRef dependency should be skipped if the call fails and the response variable does not get set, but it should not be automatically skipped if the call completes but an assertion fails (or multiple assertion fail). If an assertion fails, we at least can detect the condition programmatically and use the $cancel variable to submit or cancel a request, but if we automatically skip it on a failed assertion, there is no way around.

Does this make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions