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

pick the most-testable object or set of methods/functions and write tests. #69

Open
deutrino opened this issue Mar 3, 2015 · 2 comments
Assignees

Comments

@deutrino
Copy link
Collaborator

deutrino commented Mar 3, 2015

This might do it: https://theintern.github.io/

@dgets
Copy link
Owner

dgets commented Mar 3, 2015

I'll take a peek at that, but I could use a little bit of assistance in determining what the most-testable object is. I have only the foggiest of clues.

@dgets dgets added this to the Better Code Layout milestone Mar 3, 2015
@dgets dgets self-assigned this Mar 3, 2015
@deutrino
Copy link
Collaborator Author

deutrino commented Mar 3, 2015

Assuming you're using objects with methods, or even if you're just using functions, the most testable will be methods/functions with one input, one output, and no side effects.

Higher-level functional tests can cover some less-well-written code, in that you get the test passing, and later change a method with a side effect somewhere in the spaghetti and suddenly your test fails. For example, let's say scanning all message bases for new messages is a horrible clusterfuck, you may still be able to test it at a higher level by creating/deleting/foo-ing fake messages in a test DB and then having the test blow up if the output of the clusterfuck is incorrect. This is less good than unit testing but it still has value in preventing regressions which are very common in spaghetti code.

So what I meant was, "in your source, either find the blob of best-written functions connected to an object or not, or if they're scattered everywhere, make a list of some simple well-written ones." Then you can learn the ins and outs of both testing itself and the particular framework and related concepts (e.g. code coverage) while writing tests for code that hopefully won't immediately be exposed as needing 25 hours of refactoring as soon as you write tests you expect to pass which don't.

On Mon, 02 Mar 2015 19:56:04 -0800, Damon Getsman notifications@github.com wrote:

I'll take a peek at that, but I could use a little bit of assistance in determining what the most-testable object is. I have only the foggiest of clues.


Reply to this email directly or view it on GitHub:
#69 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants