Reactive Systems logo

Automated Testing and Validation with Reactis®

July 22, 2017
Newsletters
Communicator
 
Spacer
Back to Communicator Archive
To : Reactis Users
From : Reactive Systems, Inc.
    http://www.reactive-systems.com/
Date : April 10, 2014

Reactis for C V2014 Released


R Reactis® for C V2014 is ready for download, offering an array of new features and enhancements. Like prior versions, V2014 automatically generates comprehensive test suites from C code. The generated tests can help uncover and diagnose many types of runtime errors or check for conformance of code to a model (when used as part of a model-based design process). Newly supported language constructs, performance enhancements, and bug fixes have greatly expanded the set of programs for which Reactis for C is effective. Ease-of-use improvements aim to simplify the steps for preparing code for use with Reactis for C.

 

In the case of a model-based design process, V2014 has new functionality to support back-to-back testing which may be used to check if a C code implementation conforms to a Simulink®/Stateflow® model as follows:

  1. For a model cruise.slx, use Reactis for Simulink to generate a comprehensive test suite cruise.rst from cruise.slx. As a part of this process, a file cruise.rsi is created to store testing-related information such as the application inputs and outputs, as well as constraints on the values inputs should assume during testing.
  2. Create C code to implement the model (either with an auto code tool or by hand coding or a combination of the two).
  3. Using Reactis for C V2014, import the information in cruise.rsi into a test harness stored in cruise.rsh.
  4. Using the new harness, directly run cruise.rst on the C code implementation of the application. Any differences between the outputs computed by the C code and those generated by the model (stored in cruise.rst) will be flagged. Detailed coverage reports describing which targets in the C code are exercised by the tests can be generated. Reactis Simulator also offers debug capabilities (e.g. breakpoints, scopes, reverse stepping) to diagnose any errors uncovered by the tests.

In V2014 it is also now possible to tag individual fields of a structure as inputs or outputs of a test harness. Additionally, two new stubbing features help in cases when a program under test references libraries for which source code is not available:

  • A new stub generator produces a source file containing definitions of any missing functions or variables.
  • If on-the-fly stubbing of undefined functions is turned on, Reactis for C will automatically treat any undefined function as having no side-effects and returning a value of zero.

The V2014 version of Reactis Simulator offers several new features. Previously, when executing a program in Simulator, it was possible to step forward through your code one statement at a time; however, it was not possible to step backward one statement at a time. This capability has been added in V2014, and is particularly useful when execution is interrupted by an error, as it allows you to inspect values as you move backward through a program to the root cause of an error. Simulator also offers a new report to summarize the results of executing tests. A generated HTML report details any errors encountered during simulation, as well as any differences seen between the output values stored in the test suite and the values computed by the executing C code. The report also includes function call counts and the maximum recursive depth reached by each function. New options are also now available when importing or exporting CSV formatted test data.

The Reactis Test Suite Browser now offers ways to hide both rows (inputs/outputs) and columns (test steps) when viewing tests. Column filtering is controlled by a Boolean expression over the data items within the test suite. Only steps for which the filter expression evaluates to true will be displayed. For example, to see each step where the cruise control is active, you would use the filter expression "active == 1".

Reactis for C V2014 supports a new coverage metric know as Multiple Condition Coverage (MCC). MCC offers an even more comprehensive level of testing than is afforded by the previously supported MC/DC. Note that MCC requires that for every decision, all combinations of condition outcomes must be observed. For example, consider the decision with three conditions: A && B && C. The MCC targets for this decision are listed in the table below, in which each row represents an MCC target: the final column contains the decision outcome, while all other columns contain a condition outcome. A T indicates the condition evaluated to true, an F represents false, and an x indicates the condition was not evaluated due to short-circuiting. Note that in C code all expression evaluations are short-circuited.

ABCDecision
FxxF
TFxF
TTFF
TTTT

As is the case for all metrics supported by Reactis for C, Reactis Tester attempts to exercise as many MCC targets as possible and Reactis Simulator offers many ways to track MCC. A simple yet powerful filtering mechanism lets you instruct Reactis for C to display all MCC targets meeting a given criterion. For example, you can display all covered MCC targets where A is true and C is false. Even if MCC tracking itself is not of interest to you, the ability to easily explore the coverage of MCC targets is helpful when aiming to achieve high levels of MC/DC coverage. The filtering mechanism is toggled by clicking on column headers as shown below: MCC filtering to display specified targets

Another new feature of V2014 is that Reactis for C can be configured to create decision targets for Boolean expressions which appear throughout a program, such as the first argument of the ternary operator (e1? e2: e3) or on the right-hand side of an assignment x = y || z. Naturally, for each new decision target, additional condition, MC/DC, and MCC targets are also created, resulting in a more comprehensive set of metrics for the code under test.

V2014 also extends the subset of the ANSI C99 standard supported by Reactis for C. The following are now supported:

  • C99 Compound literals. Prior to the C99 revision of the ANSI standard, literals were restricted to scalar types, such as int or float. A compound literal is a literal expression whose type is a structure, union, or array. The syntax for a compound literal is a type enclosed in parentheses, followed by a brace-enclose list of initializers, such as (double[3]){2.7,-0.1,11.1} or (struct Pair){1,5}.
  • C99 inline functions. The handling of inline functions has been brought into compliance with C99.
  • _Pragma operator. Support has been added for the C99 _Pragma operator.
  • _Bool type. Support for the _Bool type is improved. Variables of type _Bool now appear as Boolean harness elements.

Other improvements include:

  • Performance improvements which make compiling, linking, and generating tests faster.
  • The Reactis for C API now includes new functions to create coverage reports after creating a new test suite (rsTesterWithReport) and running existing test suites (rsSimRunSuiteWithReport).
  • Each individual compile error can now be selected in the Error dialog and highlighted in the source code.
  • Windows Universal Naming Convention (UNC) paths are now supported.
  • When you hover on a #include directive, the location of the included header file is displayed.
  • You can now specify a maximum time interval after which execution is interrupted if no outputs have been produced. This makes it easier to determine the cause of infinite or excessively long loops.
  • A system administrator can now disconnect a user from the license manager in order to free the occupied license.

Reactis is a registered trademark of Reactive Systems, Inc. MATLAB, Simulink, and Stateflow are registered trademarks of The MathWorks.

Best Regards,
The Reactis Team


Back to Communicator Archive
Spacer