The documentation for AssertExpectations
says "AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order." What if I want to assert that some calls happen in-order?
gomock has *Call.After(*Call)
for this, but I can't see anything similar in testify. Is there a way, or should I just use gomock?
Testify does not support this feature currently, but it's tracked in this issue https://github.com/stretchr/testify/issues/741.
Testify's mock.Mock
object provides access to the ordered calls through the Calls
property (https://pkg.go.dev/github.com/stretchr/testify/mock#Mock), which you could use to build this functionality yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With