-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QA] Check and remove the use of setResponse()
and $this->response
in the Given/Then steps
#7082
Comments
maybe this old issue help owncloud/core#39512 and owncloud/QA#517 In the past, we emptied HTTP status code in the
|
Never save responses in Given steps. Let the response scope be only within the Given steps. That way we don't have to worry about clearing the response/statuscode stores. |
so there is two tasks here
Am I correct @saw-jan |
If those are done in Given/Then steps or helper functions then yes. But if you mean everywhere in the test code then no. |
recently something catches my attention we call |
Yeah, that should be part of this ticket.
|
yes, I agree. We did this sort of pattern in quite a lot of places already. Forexample, I see in FavoritesContext (happens to be in core, but similar examples will be in ocis test code:
The |
If you go on refactoring Given steps and helper functions then you will know which test suites are affected. So, IMO, this ticket cannot be divided by test suites. But I am just letting you know. You can continue your way. |
should i go context wise then? |
maybe yes. |
@KarunAtreya I've updated the above checklist to include the backport checklist as well. Can you please backport your related PRs and link them there |
Prevent use of step-def functions in other steps-defs wherever possible (strictly prevent the reuse between cross steps). Master
stable-5.0
|
|
We have used
setResponse()
and$this->response
in the Given/Then steps and some helper functions (maybe to reuse existing available methods). But storing responses from Given/Then steps and helper functions is not a good idea because it can lead to a false positive assertion in the Then steps.For example,
ocis/tests/acceptance/features/coreApiVersions/fileVersions.feature
Lines 18 to 21 in ff304df
Here, the When step is upload resource and Then step checks that the When step's response code is
200
which is wrong here but the test passes. This is because of the saved response from Given step.Open tasks:
setResponse()
and$this->response
in$this->response
but must prevent saving to it)theHTTPStatusCodeShouldBe()
so that it can accept response object to get statuscode from [tests-only][full-CI] make httpresponse check function able to accept response object as parameter #7169The text was updated successfully, but these errors were encountered: