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

Test refactors should utilize a TDD approach #589

Open
jonbrenner opened this issue Jun 24, 2022 · 0 comments
Open

Test refactors should utilize a TDD approach #589

jonbrenner opened this issue Jun 24, 2022 · 0 comments

Comments

@jonbrenner
Copy link

When we refactor our tests in the book, we often begin by implementing new structs/functions before using them in the test cases. For example, see the Still Some Problems section in the Mocking chapter. Here we implement the new spies for checking the order of operations prior to using them in the sleep before every print test.

In my opinion, we should continue to use a TDD approach in refactors by specifying the usage of the new code before the implementation of it. In other words, we use write the sleep before every print test first and then let the errors guide us to the implementation of the SpyCountdownOperations spy. This "specify, then implement" process reinforces the notion that TDD is a design technique as much as a testing technique.

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

1 participant