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

Try out a new pattern for large table tests #166

Merged
merged 1 commit into from
Nov 28, 2020

Conversation

dnephin
Copy link
Member

@dnephin dnephin commented Nov 22, 2020

Once a table test grows past a certain point it becomes very difficult
to work with. A failure in one case requires scrolling around attempting
to find the case, because the failure message only includes the line in
the test function, not the testCase.

Instead of a slice or map of test cases, using this runCase function to
add a t.Log will give the line number of the testCase as well as the
line number in the test function. This makes it very easy to jump to
both of the relevant lines.

Best viewed with hide whitespace changes.

Once a table test grows past a certain point it becomes very difficult
to work with. A failure in one case requires scrolling around attempting
to find the case, because the failure message only includes the line in
the test function, not the testCase.

Instead of a slice or map of test cases, using this runCase function to
add a t.Log will give the line number of the testCase as well as the
line number in the test function. This makes it very easy to jump to
both of the relevant lines.
@dnephin dnephin merged commit e6cd46c into gotestyourself:main Nov 28, 2020
@dnephin dnephin deleted the testcases_example branch December 7, 2020 16:57
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.

None yet

1 participant