White Box Testing
Test your code
   Home      TestPattern-StressTestPatterns
Author -  Marc Clifton
Marc is the creator of two open source projets, MyXaml, a declarative (XML) instantiation engine and the Advanced Unit Testing framework, and Interacx, a commercial n-tier RAD application suite.  Visit his website, www.marcclifton.com, where you will find many of his articles and his blog.
Marc lives in Philmont, NY.

Stress-Test Patterns

Most applications are tested in ideal environments--the programmer is using a fast machine with little network traffic, using small datasets.  The real world is very different.  Before something completely breaks, the application may suffer degradation and respond poorly or with errors to the user.  Unit tests that verify the code's performance under stress should be met with equal fervor (if not more) than unit tests in an ideal environment.

The Bulk-Data-Stress-Test Pattern

This test is designed to validate the performance of data manipulation when working with large data sets.  These tests will often reveal inefficiencies in insertion, access, and deletion processes which are typically corrected by reviewing the indexing, constraints, and structure of the data model, including whether code is should be run on the client or the server.

The Resource-Stress-Test Pattern

Resource consumption stress testing depends on features of the operating system and may be served better by using mock objects.  If the operating system supports simulating low memory, low disk space, and other resources, then a simple test can be performed.  Otherwise, mock objects must be used to simulate the response of the operating system under a low resource condition.

The Loading-Test Pattern

This test measures the behavior of the code when another machine, application, or thread is loading the "system", for example high CPU usage or network traffic.  This is a simulation only (which does not use mock objects) and therefore is of dubious value.  Ideally, a unit test that is intended to simulate a high volume of network traffic would create a thread to do just that--inject packets onto the network.