Skip to content
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

[ISSUE-70] Possibility to not fail the test during retries #72

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

siller174
Copy link
Collaborator

No description provided.

Copy link
Contributor

@samybenatt samybenatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, only few minor comments, thanks for the implementation!

examples/single_test.go Show resolved Hide resolved
RequestRepeatOptional(optional bool) RequestHTTPBuilder

// RequestRepeatBroken is a broken politic for repeat request.
// If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will execute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will execute.

I guess you mean t.Fail() will not execute here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, t.fail will be executed if we have a broken test. What do you think about it? Is it good way or not?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that Broken will be very similar to just keep default behaviour then
I was thinking that you introduced the Broken flag to have another way of handling the tests.

Basically I thought as follow:

  1. Optional: true -> Will mark the retry as skipped and not fail the whole test
  2. Broken: true -> Will mark the retry as failed, the whole test as broken, but not fail the whole test
  3. Optional: false, Broken false -> Will mark the retries as failed as well as the overall test as failed

Let me know if my understanding is incorrect

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken true -> Will mark the retries as failed as well as the overall test as failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siller174 Sorry for late reply, let me give more details:
image
This is currently what is happening when I put Optional: true

Here is what I had in mind with the optional mechanism:

  1. If all retries are failing -> fail the test and do not execute the rest of the test (assertions and so on)
  2. If after x retry (x < maxRetryCount), the x retry is successful, continue the rest of the test (assertions and so on)

Aside from this, for now the retry is mostly based on the HttpCode assertion, but I would say it can apply to all kind of assertions instead (body assertion, http code assertion, header assertion, response assertion)
i.e. if any kind of assertion fails during the test process, apply the same retry logic as mentioned in points 1. and 2. above

interface.go Outdated Show resolved Hide resolved
@siller174 siller174 merged commit b0638c3 into master Apr 22, 2024
3 checks passed
@siller174 siller174 deleted the release/issue-70 branch May 17, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants