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

Rework testing fixtures #74

Closed
grepory opened this issue Apr 18, 2017 · 6 comments
Closed

Rework testing fixtures #74

grepory opened this issue Apr 18, 2017 · 6 comments
Assignees

Comments

@grepory
Copy link
Contributor

grepory commented Apr 18, 2017

I want us to move to an Interface + Mock methodology for unit testing. So instead of having an in-memory fixture store that's incapable of easily simulating all interactions with a Store (i.e. simulating error cases is brittle and/or non-trivial), I'd like us to move back to the mock store that was there before + testify.mock behavior simulation in faked methods per test. (We can develop some reusable faked methods if this ends up being super copypasta).

The key being that the mock should simulate behavio

@grepory
Copy link
Contributor Author

grepory commented Apr 18, 2017

The current fixtures package should go away, and knowledge of how to create fixtures for given models (structs) should reside next to the structs themselves within the test code for that package. E.g. in the types package, in check_test.go, we would have func FixtureCheck(string) *Check -- so that test code in another package can import types and call types.FixtureCheck("my_check") to get a generated check with an identifiable Name field.

@grepory
Copy link
Contributor Author

grepory commented Apr 18, 2017

@portertech @palourde @amdprophet -- I would love some feedback on this approach. If you'd like, I can concretize this in a PR this week so you can see exactly what I'm talking about.

@portertech
Copy link
Contributor

Toss it into types! 👍

@portertech portertech changed the title Rework testing fixutres Rework testing fixtures Apr 19, 2017
@portertech
Copy link
Contributor

@portertech
Copy link
Contributor

We need to migrate older test code to use this method of fixtures.

@grepory
Copy link
Contributor Author

grepory commented Apr 25, 2017

Fixed with #97

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

No branches or pull requests

2 participants