-
Notifications
You must be signed in to change notification settings - Fork 18
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
Possibility to not fail the test during retries #70
Comments
Hello. |
Or you can do it as you described. |
Sure, I just wanted to validate the approach with you first, let me create a pull request! |
@siller174 #71 |
Thank you! I will check PR |
@samybenatt Sorry for the delay. Could you please review my implementation for your request? |
Hi @siller174, thanks for taking time to implement this! I've sent very minor comments on the PR but overall lgtm! |
Thank you again! Released https://github.com/ozontech/cute/releases/tag/v0.1.20 |
@siller174 Based on my latest comment I think I wrongly understood your implementation I think there is still one thing missing:
Basically, in pseudo-code: |
@siller174 Here is a concrete example: import (
"context"
"github.com/ozontech/cute/asserts/headers"
"net/http"
"testing"
"github.com/ozontech/cute"
)
func Test_Table_Array(t *testing.T) {
tests := []*cute.Test{
{
Name: "test_1",
Request: &cute.Request{
Repeat: &cute.RequestRepeatPolitic{Count: 4, Optional: true},
Builders: []cute.RequestBuilder{
cute.WithURI("https://httpstat.us/Random/203,200,201"),
cute.WithMethod(http.MethodGet),
},
},
Expect: &cute.Expect{
Code: 200,
AssertHeaders: []cute.AssertHeaders{headers.Present("Content-Type")},
},
},
{
Name: "test_2",
Middleware: nil,
Request: &cute.Request{
Repeat: &cute.RequestRepeatPolitic{Count: 2, Optional: true},
Builders: []cute.RequestBuilder{
cute.WithURI("https://httpstat.us/Random/201,202"),
cute.WithMethod(http.MethodGet),
},
},
Expect: &cute.Expect{
Code: 200,
},
},
}
cute.NewTestBuilder().
Title("Example table test").
Tag("table_test").
Description("Execute array tests").
CreateTableTest().
PutTests(tests...).
ExecuteTest(context.Background(), t)
} The above example tests will be:
Here is the result in the allure report and in the test run: As you can see, for the test_1, my assert header is never executed while one of the retry was successful |
cute/roundtripper.go
Lines 103 to 108 in 9389b60
Would it be possible to have a way to configure this part to return optional error.
For example, here:
cute/test.go
Lines 56 to 58 in 9389b60
Add an OptionalError bool that, if defined to
true
, will returncuteErrors.NewOptionalError
instead ofcuteErrors.NewAssertError
If the count has reached its last index, then switch back
cuteErrors.NewAssertError
and ultimately fail the testThe text was updated successfully, but these errors were encountered: