# component

The keyword is used to define a test component type.

- Test component is an entity on which test behavior is executed
- Test component is owner of the test ports
- Constants, variable and timers declared in the component type are visible from all functions and test cases, which execute on that very component type
- Several test components can run in parallel - each executes independently

Related keywords:

- type
- extends
- port
- const
- var
- timer

### type component component_identifier { [ port_instance; ] [ const_def; ] [ var_instance; ] [ timer_instance; ] };

- The type component keywords introduce the component definition.

- component_identifier is the name used to refer to the component. Must begin with a letter, may contain letters, numbers and underscore characters.
  According to the Naming convention, the suffix _CT is recommended.

- port_instance identifies the ports owned by the port. For the syntax see the initial keyword port.

- const_def defines constants visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword const.

- var_instance identifies variables visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword var.

- timer_instance identifies timers visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword timer.

Every element within the curly brackets may be repeated.

Example 1:

type component MyComponentType_CT {
port MyMessagePortType_PT P1_PCO,P2_PCO;
const bitstring c_MyConst := â1001âB;
var integer v_MyVar;
timer T_MyTimer := 1.0;
}

The component called MyComponentType_CT is declared.
It contains two ports (P1_PCO,P2_PCO) of type MyMessagePortType_PT,
a constant called c_MyConst which equals 1001,
a variable called v_MyVar
and a timer called T_MyTimer with a default value of 1 second.

BNF definition of component