# connect

The operation is used to connect the ports of a test component to the ports of another components.

- The operation directly connects one port to another with the in side connected to the out side and vice versa.;
- a port may be connected to several ports (connect used several times);
- the messages (signatures) defined for both ports must match, i.e., the incoming port must be able to receive all outgoing messages from the connected port;

Related keywords:

- create
- mtc
- self

### connect (component_referenceA:port_referenceA , component_referenceB:port_referenceB);

- The connect keyword introduces the port connection. The indices A and B refer to the two sides of the connection.

- component_reference is one of the following:

  - a reference returned by the create operation,
  - the keyword self when referring to the component where connect is given,
  - the keyword mtc when referring to the main test component.

- port_reference points out the port to be connected.

Example:

var MyComponentType_CT vc_MyNewPTC := MyComponentType_CT.create;
connect(vc_MyNewPTC:Port1_PCO, mtc:Port3_PCO);

The component of type MyComponentType_CT is created in the first line.
In the second line, its reference (vc_MyNewPTC) is used to point out the port on the side A of the connection (vc_MyNewPTC:Port1_PCO).
On the side B of the connection is the port called Port3_PCO of the main test component.

BNF definition of connect