|
File TestingXcom.html
Author McKeeman
Copyright © 2007
index
Testing xcom
The testing harness for code under development is as important at the
final product. The tests serve at least as repeatable experiments,
as quick checks,
as a means to break a complex task into simple tasks,
as a source of examples of use.
There are three main categories of tests for xcom: tests,
trials and times.
The testing code is kept in separate directories with the above names.
Each category has a master routine (testAll(), tryAll() and timeAll())
that runs all of the corresponding test code.
The goal is that every feature is unit tested (complete coverage).
This goal is often too ambitious, but can be approached over a
period of time.
-
Unit tests. Each unit test is isolated to a single feature.
Sometimes, as a matter of convenience, a unit test may use other
features.
In this case, one is well advised to insure that the tests of the other
features are already checked. The unit tests are intended to indicate
trouble but not diagnose it.
In MATLAB it is relatively easy to add output to the test just before the
point failure and rerun the test to understand the cause of failure.
Or use the MATLAB debugger.
Unit testing is fragile in the sense that if one test reveals a fault,
the whole process stops (and later tests do not get run).
-
Unit trials A unit trial is relatively verbose. The intention
is to expose the inner details of the tested algorithm.
Often, during development, the trial is developed alongside the working
code.
When both seem to be working correctly, the trial is used as a design
template to make a test. When change is made, the trial is extended
and the test again finally augmented.
-
Performance Timing xcom compile and execute time can
be measured. There are also
time unit tests.
| |