gunit vs. testify

Surprisingly similar on the surface...

May 15, 2021

Disclaimer

I am the original author of gunit and the oft-associated assertions packages.

TL;DR

Similarities

  1. Similar startup: suite.Run & gunit.Run
  2. Both provide access to *testing.T
  3. Similar Setup/Teardown for test cases
  4. Bottom Line: simple test suites defined in both gunit-style and testify-style look almost identical!

github.com/stretchr/testify/suite

  1. employs "shared" fixtures - uses the suite instance provided to testify.Run
  2. sequential execution (ONLY?)
  3. if t.Parallel() is used in setup in an attempt to enable parallel/random execution of test cases, data races will undoubtedly occur
  4. because the provided suite instance is used it is possible to wire in other integrations for assertions, etc...
  5. more complicated suite aggregation and execution is possible... (see docs)
  6. all of the testify/assert package goodies are embedded on the suite
  7. built-in integration in popular editors
  8. supports suite-level setup and tear-down (integration tests)

github.com/smartystreets/gunit

  1. employs "fresh" fixtures - uses the suite/fixture instance provided only to know what to instantiate (fresh) for each fixture
  2. very limited assertion capabilities, in practice used with assertions and assertions/should
  3. includes an option to run test cases sequentially
  4. Skip/Focus/Long prefixes modify execution of tests, independent of any editor integration/settings
  5. weak integration with editors (requiring use of Focus prefix for debugging)

References:

-Michael Whatcott