8

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?

barrucadu
  • 556
  • 4
  • 8

1 Answers1

1

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.

Cameron Little
  • 3,487
  • 23
  • 35