O'Reilly logo

Extreme Programming Installed by Chet Hendrickson, Ann Anderson, Ron Jeffries

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TestN and More

Write testN(), with, say, five items. It will also pass.

What else can give you problems? One possible problem occurs when we do a sequence of queries—can we get "leftovers"? For example, a query returning five items followed by a query returning three items should have only three items in the table. (If the table were improperly cleared, we might see the last two items of the previous query.)

We can test a sequence of queries:

 public void testQuerySequenceForLeftovers() { SearchPanel sp = new SearchPanel(); sp.setSearcher (new TestSearcher()); sp.queryField.setText("5"); sp.findButton.doClick(); assert(sp.resultTable.getRowCount() == 5); sp.queryField.setText("3"); sp.findButton.doClick(); assert(sp.resultTable.getRowCount() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required