Skip navigation.

Archives

Chapter 9. Passing the First Test

We've posted another episode from our long worked example.

At the start of every test run, we need our test script to start up the Openfire server, create accounts for the Sniper and Auction, and then run the tests. Each test will start instances of the application and fake auction and test their communication through the server.

We've also made some changes in response to comments on the discussion list

Seeking Exceptional Agile .NET Developer, West London

Pardon my French, but are you a sh*t -hot .NET developer living in the London area?

Might you by any chance be available for contract work in the near future?

Have you got strong Extreme Programming muscles, and have you graduated from the University of Actually Doing It For Real?

Do you know your "distance from the main sequence" from your "dependency injection"?

New Book In Progress - Growing Object-Oriented Software, Guided By Tests



Craftsmanship seems to be the growing trend for 2008-2009 in the Agile community.

Another book about the nuts and bolts of creatinjg great code is on the way courtesy of UK Agile pioneers and all-round OO experts Nat Pryce and Steve Freeman.

G

TotT: Data Driven Traps!

When writing a unit test, it is tempting to exercise many scenarios by writing a data-driven test. For example, to test the function IsWord, you could write (ARRAYSIZE is a macro that returns the number of elements in an array):

const struct {const char* word; bool is_word;} test_data[] = {
  {"milk", true}, {"centre", false}, {"jklm", false},
};

TEST(IsWordTest, TestEverything) {
  for (int i = 0; i < ARRAYSIZE(test_data); i++)
    EXPECT_EQ(test_data[i].is_word, IsWord(test_data[i].word));
}