Skip to content
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

make test-cases explicit for IDE + subtest #6548

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

dkrotx
Copy link
Member

@dkrotx dkrotx commented Dec 9, 2024

What changed?
adding SetupSubTest/TearDownSubTest (requires testify 1.9.0) to make
sure subtests are starting with their own test controllers.
Otherwise adding a new test with different expectations on mocks could
produce a misleading output.

Also made test-cases visible for GoLand. It is able to run individual
sub-tests when it sees s.Run/t.Run instruction in function.

Why?
Otherwise adding a new test with different expectations on mocks could
produce a misleading output.

How did you test it?
unit-tests

Potential risks

Release notes

Documentation Changes

adding SetupSubTest/TearDownSubTest (requires testify 1.9.0) to make
sure subtests are starting with their own test controllers.
Otherwise adding a new test with different expectations on mocks could
produce a misleading output.

Also made test-cases visible for GoLand. It is able to run individual
sub-tests when it sees `s.Run/t.Run` instruction in function.
})
func (s *cliAppSuite) SetupSubTest() {
// this is required to re-establish mocks on subtest-level
// otherwise you will confusingly see expectations from previous test-cases on errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urgh... I really don't like the suite method of testing :/

ty for the fix though, really annoying bug to fix in tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I think it counters with Go idea that everything is explicit and there is no "magic". Suite definitely brings some. Unfortunately, there are so many tests that migrating seems too much of work.
...which reminds me, though - maybe I should just use ChatGPT for that!

@dkrotx dkrotx merged commit b08852b into cadence-workflow:master Dec 10, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants