For testing, golang best practices state that tests should keep going as long as possible to give as much information about the failed test as possible. This is particularly critical in flaky and/or long-running tests where reproducing the failure takes considerable time and effort.
In standard golang testing this is achieved using t.Errorf, which marks the test as failed and continues, instead of t.Fatalf, which marks the test as failed and aborts immediately. I don't see a similar mechanism in gomega for making assertions which should continue.
From what I can tell, these solutions available in gomega today:
- Gather your assertions into a map or struct which can be checked in a single Expect.
- Write a custom matcher.
But these solutions can be clunky, tedious, and complex cases require a deep understanding of gomega. It becomes particularly difficult and unergonomic when trying to combine complex assertions involving a few different objects.
Could it be considered to provide another assertion option which would fail the test and continue? This feature would make it relatively trivial to follow testing best practices to expose as much information about test failures as possible.
In case, I've missed an existing solution which is similarly trivial, it may be worth highlighting more prominently in the docs. I did Ctrl-F Errorf and Fatalf in https://onsi.github.io/gomega/ and scanned through but I didn't see anything.
For testing, golang best practices state that tests should keep going as long as possible to give as much information about the failed test as possible. This is particularly critical in flaky and/or long-running tests where reproducing the failure takes considerable time and effort.
In standard golang testing this is achieved using
t.Errorf, which marks the test as failed and continues, instead oft.Fatalf, which marks the test as failed and aborts immediately. I don't see a similar mechanism in gomega for making assertions which should continue.From what I can tell, these solutions available in gomega today:
But these solutions can be clunky, tedious, and complex cases require a deep understanding of gomega. It becomes particularly difficult and unergonomic when trying to combine complex assertions involving a few different objects.
Could it be considered to provide another assertion option which would fail the test and continue? This feature would make it relatively trivial to follow testing best practices to expose as much information about test failures as possible.
In case, I've missed an existing solution which is similarly trivial, it may be worth highlighting more prominently in the docs. I did Ctrl-F
ErrorfandFatalfin https://onsi.github.io/gomega/ and scanned through but I didn't see anything.