Glossary
|
Acronym
|
Definition
|
|
SPO
|
Software Production Operation
|
|
SUT
|
System Under Test
|
|
CSE
|
Communication & Scheduling Entity
|
|
TAM
|
Target Abstraction Module
|
|
Tal
|
Targeted Application Layer
|
|
BL
|
Behavior Layer
|
|
ML
|
Middleware Layer
|
Referenced Documents
|
Document
|
Internal Reference
|
|
Component Tester - Test Case Specification
|
[1]
|
|
UML & SysML to C - Operation Specification
|
[2]
|
|
UML & SysML to C - Statemachine Code Generator
Specification
|
[3]
|
|
UML & SysML to C - Activity Code Generator Specification
|
[4]
|
|
UML & SysML to C - Assembly Code Generator Specification
|
[5]
|
|
C Code Architecture Specification
|
[6]
|
General Concepts
The Component Tester
Generator is an operation producing a
ready-to-build test harness from
the generated code of a component.
It takes as input:
-
the generated source code of a component (the
System Under Test, or SUT),
produced by a code generation operation (see
[2]), and
-
the original UML / SysML source model (
.mdzip
/ .mdxml / .esp) of the
same component.
From these inputs the operation produces:
-
a model-specific test API
(
TestCase_Api_Gen.h /
TestCase_Api_Gen.cpp) exposing the interface
elements, instance properties, behavior members, event injection
points and server operations of the component;
-
a model-independent test API
(
TestCase_Api.h) providing logging,
traceability, scheduling and assertion services;
-
the supporting harness files (CSE configuration, shared objects,
hooks), the build files (makefiles) and, optionally, an IDE
configuration and example test cases;
-
a compiled shared library of the SUT
(
sut.dll) when compilation is requested.
A test case is then written by the user in C or C++ against these
APIs. It drives the inputs of the model, advances the virtual
execution time and verifies the evolution of the model (interface
data, instance properties, active states of state machines, active
nodes of activities). See
[1] for the test case
format and the available APIs.
Relationship with the code generation operation
The Component Tester is driven by the cpp
model, which is closer to the generated code than the
design model. The cpp model is rebuilt from the source
.mdzip / .mdxml using the
same pipeline as the code generation operation.
To guarantee that the generated test API matches the generated
code, two characteristics of the SUT are mirrored automatically by
the operation:
-
Language (C / C++): the
operation detects whether the SUT is C or C++ from the
generated sources (presence of a C++ header
.hpp means the SUT is C++) and rebuilds the
cpp model with the same language, so that class and member
names — and the friend accessor signatures used to reach
internal members — match the generated code.
-
Instrumented code: the
value of the
instrumented_code parameter
must be the same as the one used when generating the SUT.
Instrumented code adds the variables that monitor the active
states / transitions of state machines and the active nodes /
flows of activities (see
[3] and
[4]). Without it,
the behavior-monitoring part of the test API
(b_ members) is not available.
Instrumented behavior monitoring
When the SUT is generated with instrumented code, the generated
test API exposes, in addition to interface data and instance
properties:
-
the active state and
active transition of each
state machine;
-
the active node and the
active flows of each
activity;
-
an event injection function
per behavior, allowing a test case to send any event directly
to the input event pool of that behavior.
See document
[1]
for the naming conventions (i_,
p_, b_ prefixes) and the
corresponding functions.
Input Elements
Validation Constraints
Not applicable. The Component Tester Generator consumes code and a
model that have already been validated by the code generation
operation. Validation constraints are described in the code
generation specifications. See
[2].
Code Generator Specification
Software Production Operation Identity Card
|
Characteristics
|
Values
|
|
Name
|
Tester Generator
|
|
Status
|
BETA
|
|
Nature
|
Component generation
|
|
Description
|
This operation generates a test harness for a component:
- a model-specific test API exposing interfaces, instance
properties, behavior members and events
- the harness, build and IDE files
- optionally the compiled SUT shared library
|
|
Scan description
|
The scan lists the components / classes that can be
tested.
|
|
Supported files
|
- .mdzip
- .mdxml
- .c / .h
- .cpp / .hpp
|
|
Input objects
|
A single component (root object) with its generated code
and source model
|
|
Return codes
|
0: Generation is successful.
1: Input data are incorrect. Generation cannot be
executed.
2: Generation is unsuccessful.
|
|
Feature
|
Application generation - 100 credits
|
Parameters
dry_run parameter
|
Attributes
|
Values
|
|
Name
|
dry_run
|
|
Description
|
Optional parameter. It describes if the generation is
executed in dry mode to obtain the log and validation
report without producing any output.
Hidden in CATIA Magic.
Note: This option does not consume any credits.
|
|
Type
|
Boolean
|
|
Values [Default]
|
Yes / [No]
|
|
Multiplicity
|
0..1
|
mode parameter
|
Attributes
|
Values
|
|
Name
|
mode
|
|
Description
|
Optional parameter to specify the operations to be
executed.
full generates the
harness then compiles the SUT.
generation only
generates the harness and the build files.
compilation only
compiles a previously generated harness.
|
|
Type
|
Enumeration
|
|
Values [Default]
|
[full], generation, compilation
|
|
Multiplicity
|
0..1
|
instrumented_code parameter
|
Attributes
|
Values
|
|
Name
|
instrumented_code
|
|
Description
|
Optional parameter to specify if extra instrumented code
is generated. Instrumented code consists of additional
information to monitor the behavior of activities and
state machines during execution (active state /
transition, active node / flows).
This value must match the one
used to generate the SUT. When set to true,
the test API exposes the behavior members
(b_ prefix) and the event injection
functions.
|
|
Type
|
Boolean
|
|
Values [Default]
|
Yes / [No]
|
|
Multiplicity
|
0..1
|
pool_threshold parameter
|
Attributes
|
Values
|
|
Name
|
pool_threshold
|
|
Description
|
Optional parameter to specify a pool threshold used to
monitor the consumption of the event pools during
execution. Expected value is a real value between
0.0 and
1.0. This parameter
is used only if instrumented_code is
set to true.
|
|
Type
|
Double
|
|
Values [Default]
|
[1.0]
|
|
Multiplicity
|
0..1
|
generate_testcase_examples parameter
|
Attributes
|
Values
|
|
Name
|
generate_testcase_examples
|
|
Description
|
Optional parameter to specify if an example of C and C++
test case is generated to help the user start writing
test cases.
|
|
Type
|
Boolean
|
|
Values [Default]
|
Yes / [No]
|
|
Multiplicity
|
0..1
|
ide parameter
|
Attributes
|
Values
|
|
Name
|
ide
|
|
Description
|
Optional parameter to specify the IDE configuration to
generate alongside the harness, so that the test project
can be opened, built and debugged directly.
|
|
Type
|
Enumeration
|
|
Values [Default]
|
[none], vscode
|
|
Multiplicity
|
0..1
|
environment_path parameter
|
Attributes
|
Values
|
|
Name
|
environment_path
|
|
Description
|
Optional list of extra paths to be added to the current
Path environment variable used for
compilation on Windows. The path is used to find the
make and gcc /
g++ commands.
Hidden in CATIA Magic.
|
|
Type
|
String
|
|
Values [Default]
|
N/A
|
|
Multiplicity
|
0..*
|
output parameter
|
Attributes
|
Values
|
|
Name
|
output
|
|
Description
|
Optional parameter that specifies the output directory
in which resources are stored. If null, the generator
generates a folder named after the component.
Hidden in CATIA Magic.
|
|
Type
|
String
|
|
Values [Default]
|
N/A (defaults to the component name)
|
|
Multiplicity
|
0..1
|
Files Specification
The operation generates a model-independent test API header
TestCase_Api.h providing the logging,
traceability, scheduling and assertion services described in
[1].
The operation generates a model-specific test API
TestCase_Api_Gen.h /
TestCase_Api_Gen.cpp exposing, for the tested
component:
-
the interface elements (prefix
i_),
-
the instance properties of the cpp instance graph (prefix
p_),
-
when
instrumented_code is true, the
behavior members of state machines and activities (prefix
b_) and one event injection function per
behavior.
The operation generates the supporting harness files (CSE
configuration, shared objects, hooks) and the build files
(makefiles) required to compile the SUT as a shared library
sut.dll.
When generate_testcase_examples is true, the
operation generates one C example
(C_TestCase.c) and one C++ example
(Cpp_TestCase.cpp) test case.
When ide is set, the operation generates the
corresponding IDE configuration files so the test project can be
opened, built and debugged in the selected IDE.
Any character of the component name which is different from a
digit, an ASCII letter, a - or a _
is replaced by an _ in the generated folder / file
names.
Usage in CATIA Magic
The Component Tester Generator is launched on a component for which
the code has already been generated. The
instrumented_code parameter must be set to the
same value as the one used to generate the code, so that the test
API matches the generated code. Once generated, the user writes test
cases in the tester/testcases folder, builds the
harness and runs the tests. See document
[1]
for the test case format and the available APIs.
|