Académique Documents
Professionnel Documents
Culture Documents
TESSY
By Frank Bchner
All rights reserved. No part of this document may be copied or reproduced in any form or by any means without prior written
consent of Hitex GmbH. Hitex GmbH retains the right to make changes to these specifications at any time, without notice. Hitex
GmbH makes no commitment to update nor to keep current the information contained in this document.
Hitex GmbH makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. Hitex GmbH assumes no responsibility for any errors that may appear in this
document. All trademarks of other companies used in this document refer exclusively to the products of these companies.
Hitex GmbH
Greschbachstr. 12
D-76229 Karlsruhe
Germany
Contents
1. Introduction .................................................................................................. 4
2. Software Testing Issues .............................................................................. 4
2.1. Practical Problems ................................................................................................................... 4
2.2. Requirements of Common Software Quality Standards .......................................................... 5
2.3. Tessy the Ideal Solution ........................................................................................................ 5
1. Introduction
The crucial issue in achieving software quality is for the software to have zero defects. This objective
overrides others such as maintenance, portability and performance since if bugs are responsible for a
state of disorder, it would most likely result in the entire product loosing any credibility for quality and
value. Dynamic testing is the main method used to prove that software contains zero defects.
Besides being tedious and cumbersome, the process is error-prone. The entered test data is selected ad-hoc,
and how carefully the results are checked depends on the human tester and is subject to variation.
Normally neither the test data nor the test environment is saved so it is not possible to repeat tests exactly.
If the software is changed, all previous tests should be repeated. This holds even true if the software was
changed only slightly, e.g. for a bug fix. If the software was changed, a new compiler version is used to
compile the software, or if the software is ported to another microcontroller architecture, repeating all tests is
strongly recommended. If this has to be done manually, it often takes more time than is feasible and therefore
only the most important tests are repeated.
Granted, most of the above listed problems are addressed in most software development departments because of
the great importance of dynamic software testing. The general approach is to implement a proprietary test
environment. Of course, the quality of this test environment depends on the effort employed. Therefore mainly in
the big companies, which can afford it, there exist comprehensive test environments for embedded software.
These test environments can be adapted to new requirements (new test objects, compilers, etc.) and are well
maintained. However, the common situation is that a test environment is tailored to a specific test object; the
database and scripting tools involved are the favourite tools of the tester and adapting the test environment during
the development process to changing test objects (with steadily changing interfaces) takes as much effort as
extending the test object itself. Adapting these home-grown test environments to new projects is normally so
much effort that the current test environment is dropped and a new one is invented for each project.
TESSY 5/17
Necessity of documenting the tests. This should lead to full reproducibility of the tests; date of the test,
software version tested, test data used, test outcome, version of test environment used, etc.
Necessity of unit and integration testing. This means intensive testing of single units (functions in the C
language) and then integrating these units step-by-step to eventually form the complete software system.
Necessity of determining the test coverage. This reveals which parts of the source code were exercised by the
tests and, more importantly, which were not.
Even if projects not conducted according to standards or standard methods, it is a good idea to address the
issues mentioned above to at least some extent.
Taking a closer look at the C function is_value_in_range(), here the test object. Using the value 5 for range_start
and the value 2 for range_len, the following table gives the expected result, depending on the input value v1.
Fig. 2 The Test Interface Editor displays the findings of Tessy about the direction of the data flow for each variable of the
function's interface
Also, the TDE lets you select the relationship to be evaluated between a result and its expected value (e.g. equal
to, greater than, less than and others) in order to determine if a test was successful or not.
3.8. Debugging
If executing a test case with a particular set of input values did not yield the expected result, the cause(s) of the
failure needs to be determined. The tight integration of Tessy with the HiTOP debugger enables Tessy to re-run
the test case, after Tessy sets a breakpoint at the entry point of the function to be tested. Test case execution is
then interrupted automatically and control is passed to the debugger.
TESSY 10/17
Fig. 5 Debugging starts just at the beginning of the function under test, with the parameters that caused the unexpected
result
As the function is called with the exact data that caused the unexpected result to occur, the error debugging
process can begin immediately. In the example above, two line steps in HiTOP quickly reveal that a missing = in
line #28 caused the wrong result. As soon as the error is found, Tessys internal editor can be used to correct the
functions code and all tests can easily be re-run with the newly-modified test object.
2. If the external variable or function does not yet exist, Tessy will take over and define them, as follows in the
next section.
Tessy recognizes that the interface of the test object was extended by an external variable "adj" and displays this
variable in the Test Interface Editor (TIE), in the section "External variables". The context menu of the TIE allows
the user to direct Tessy to define the external variable, i.e. to allocate memory for it. This will prevent the linker
error message "undefined external" for "adj". The necessary source code is included in the test driver
automatically by Tessy.
A variable defined by Tessy is marked by a red check mark in the TIE. Of course, Tessy lets this decision to be
reversed: a previously-defined variable can be undefined also by the context menu of the TIE.
TESSY 12/17
Fig. 8 The interface of is_value_in_range() extended by an external function absolute(), for which Tessy is able to create
a stub function
Again, Tessy recognizes that the interface of the test object was extended, this time by the call to the external
function absolute(). This leads to the listing of the function absolute() in the section "External functions" of the Test
Interface Editor (TIE).
Tessy is again able to provide a replacement function (a so-called "stub" function) for the missing implementation
of the external function. Tessy can be directed to do so by using the context menu of the TIE.
Fig. 9 Tessy can create stub functions for missing external functions - note the red check mark denoting that Tessy is
allocating memory for the external variable "adj".
TESSY 13/17
However, the situation is not as easy as with external variables because Tessy cannot guess what
implementation the stub function should have. However Tessy allows the user to provide the source code for the
body of the stub function. The stub function editor is opened by the context menu of the TIE.
Fig. 10 The stub function editor allows the user to provide source code for the stubs
The source code provided by the user is automatically included by Tessy in the test driver. Tessy also takes care
of the management of the source code for the whole group of stub functions that may exist. The user does need
to worry about file names or linking issues - the user can always access and change the source code of a certain
stub function using Tessy.
It should be noted that stub functions are only intended to serve as a temporary replacement for a function until
the "real" implementation becomes available. Therefore the source code often consists only of a few lines of
code, leading to a "reasonable" behaviour of the function (e.g. a stub function may return a predefined value
instead of actually calculating one; or a stub function may just indicate that everything is in order but in fact does
not perform any check.)
TESSY 14/17
#1 int a = 0;
#2 if (cond)
#3 {
#4 a = 1;
#5 }
#6 a = 1 / a;
Even if all lines were marked as executed one or more times, it is obviously possible that no test run was made in
which the condition "cond" evaluated to 0, which in turn would prevent line #4 from being executed (i.e. the non-
existent then clause would have been executed), which in turn would have caused a division-by-zero error in line
#6.
To sum up, line coverage is a very weak measure. However, if 100% line coverage has not been achieved, it is
strongly recommended to find out what is the cause. One reason may be "dead" code, which cannot be executed
under any circumstances. Such code can be deleted. Furthermore, you may find code that was not exercised by
any of the test cases, hence you have insufficient or the wrong test cases. In any case, the test coverage has
been shown to be inadequate and that should prevent the testing from being completed.
Although line coverage is a weak measure, it is better than no measure at all and achieving 90% line coverage is
always better than achieving only 80%.
Statement coverage is similar to line coverage, but covers assembler statements instead of C language lines. An
alternative name for line / statement coverage is C0 (C-zero) code coverage.
Tessy then automatically instruments the test object and executes the tests as usual. After that, the results of the
coverage analysis are presented in a special report window.
This report shows clearly, that for example, if the first if-statement was executed 3 times but part of it was
executed only once, hence the condition of the if evaluated twice to false, which in turn means that the non-
existent else part of the if-statement was exercised twice.
By clicking on a test case in the upper left corner of the report window, the report window shows the information
for that test case only.
TESSY 17/17
7. Conclusion
Tessy is a software tool that addresses unit testing, integration testing and regression testing. Also, Tessy allows
the determination of the test coverage. However a part of Tessy, the Classification Tree Editor, addresses test
planning and test-case specification. This is the topic of another paper.