[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters
]
 |
Simple Test Framework
|
Written by Thomas
Beale.
- Targets ISE Eiffel 4.2 on Windows NT 4.0.
- 24 April 1998.
- Version 1.0.
- Copyrighted freeware.
ef_test.zip (18,738 bytes) - source
code
SIMPLE TEST FRAMEWORK TO SUPPORT IEEE-style TESTING
Philosophy
The testing philosophy used is based on that described in the
IEEE Standard for Software Test Documentation, IEEE 829-1983.
Briefly this is as follows:
- Testing consists of a Test Plan, test design, and test
result reporting.
- A Test Plan specifies a number of Test Cases (TCs), which
are usually executed according to a Test Procedure.
- The test results are then the list of Pass/Fail results
from the test cases, run according to the procedures.
Design
This simple package supports the above concepts as follows:
- A framework application TEST_APPLICATION is inherited by
any application requiring test capability; it provides a
console window menu-driven interface to TEST_SUITEs and
TEST_CASEs.
- Test Cases are implemented with descendants of the
TEST_CASE class, and are grouped under descendants of the
TEST_SUITE class. All TEST_CASEs and the TEST_SUITE of a
given suite typically inherit from a TEST_ENV descendant
class, which contains common test data sets, procedures
and utilities, thus corresponding to the Test Procedure
idea.
- Each TEST_CASE descendant must implement the execute
function, and can optionally implement the check_result
function. The check_result function is called after
'execute' and determines if the test passed or failed. In
case of failure, it calls ERROR_STATUS.set_fail_reason to
say why. This sets the 'failed' status of the test case.
- If the "all" option of the test application is
chosen, all TEST_CASEs of all TEST_SUITEs are executed,
with the results
being written into result files. The default result file
path is currently hard-wired into TEST_APPLICATION, and
may be overridden using the command line option "/d
result_dir".
Example Distribution
The example provided should compile normally, requiring only
the BASE libraries. Test cases included are contrived and simple,
due to the fact that real examples of use involve the copyright
code and systems of various organisations, not available for
distribution, or else, more esoteric libraries such as
Eiffel/Matisse.
Directory/Cluster Structure
One of the advantages of using this framework is that it
encourages some discipline in testing, namely:
- each test case coded as one class
- test cases kept in known clusters, typically
"cluster_x/test" where "cluster_x"
contains the classes under test.
- test application always available as one of the final
delivered applications to be executed at any time,
including each time a change is made to any cluster, in
the maintenance period.
To this end, a convenient directory structure I often use on
projects is:
some_root_dir/
app_1/
app_2/
app_3/
library/
cluster_a/
test/
cluster_b/
test/
cluster_c/
test/
test_app_A/
test_app_B/
Here, the test_app_Xs are seen as ordinary deliverable
applications; each cluster_x has its own set of test cases, test
suite and test environment in cluster_x/test (i.e. the test cases
etc travel with the relevant cluster).
[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters
]