API's that Suck

February 13, 2011

Meditations on Testing

Filed under: Uncategorized — Grauenwolf @ 1:20 am

There is never enough time, so first test that which you are uncertain about.

If it is easy to test, it is easy to write. If it is easy to write, it didn’t need to be tested.

Test the way the program will be used, not the way it should be used.

A wise student tests his code. A wise master tests everyone else’s.

A test is not a debugger. Nor is a debugger a test. Learn them both.

The student saw asks his master, “Why do our tests take so long to run?”
The master replies, “The services are slow.”
The student then asks, “Why don’t you mock the services so we can run the tests faster?”
The master deletes all of the test code and says, “The tests are now fast.”

All combinations of user input should be tested. Configuration files are user input.

To not test what the compiler can prove.

Play with the clock.

If a child can break it in an hour, and adult can in 5 minutes.

Advertisements

2 Comments »

  1. > The student saw asks his master, “Why do our tests take so long to run?”
    > The master replies, “The services are slow.”
    > The student then asks, “Why don’t you mock the services so we can run the tests faster?”
    > The master deletes all of the test code and says, “The tests are now fast.”

    So you basically provide no logic on top of the services that is useful to test on it’s own? Because otherwise it seems very useful to test the stuff you’ve done with mocked objects that provide specific input so you can see whether you get the expected output.

    Testing some parts with mocks doesn’t mean you can never do full integration tests.

    Comment by Matt — February 14, 2011 @ 8:16 am

    • It is good you are asking questions, but ask the first question first. What was the master testing, and why?

      Comment by grauenwolf — February 14, 2011 @ 8:42 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: