2. SODA Keywords Guide
2.1. Table of contents
2.2. Basic Concepts
This guide describes a custom keyword library designed for writing test scenarios using Robot Framework. These scenarios are specifically tailored for testing automotive features and are executed within the test environment provided by the SODA Software-Defined Rig (SDR). The guide offers comprehensive information on using specialized keywords to create efficient and effective test cases for automotive systems, leveraging the capabilities of both Robot Framework and SODA’s testing infrastructure.
This guide is founded on the following key definitions:
Object: An entity represented within the test environment configured on the SDR. These objects can be accessed, and their parameters can be set or read using keywords from the SODA Keywords library. Objects are often interconnected within the test environment, and actions on one object may lead to changes in the parameters of another.
Keyword: An operator recognized by Robot Framework when executing a test scenario. This guide specifically focuses on the keywords that comprise the SODA Keywords library.
These foundational concepts form the basis for understanding and effectively utilizing the SODA Keywords in automotive testing scenarios.
2.3. Interacting with CAN Messages and Signals
This section describes the keywords and objects used to interact with real CAN messages and their signals as presented in the test environment.
2.3.1. CAN Message Object
CAN Message Object physically manifests as a message within one of the CAN networks of the configured test environment. Using specific keywords, you can create the CAN Message Object, initiate its transmission over the network, receive it from the network, modify its contents, and either resend or halt its transmission. This object has the following set of parameters:
dbc_name - The relative path to DBC-file on SDR where the message is defined.
message_name - The unique name of the message in the scope of the DBC-file.
network_name - The unique name of the network in which the message is transmitted.
cycle_time - It refers to the period or frequency at which the message is repeatedly transmitted over the network. It is measured in milliseconds.
timeout - It refers to the period of time after which the message is considered undeliverable.
source_address - The network identifier of the message’s transmitter.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message).
Also, all signals within the message are transformed into the parameters of the object. For example, if a message contains two signals AmbientTemperature
and InnerTemperature
, the object ${msg}
will contain two parameters ${msg}['AmbientTemperature']
and ${msg}['InnerTemperature']
.
2.3.2. Create Message Keyword
Create Message Keyword creates a CAN Message Object in the context of a test scenario. All parameters of this object are obtained from the DBC file, which is specified as the invocation parameter of this keyword. This keyword doesn’t start real CAN message transmission immediately; it only creates the message as an object within the context of the test scenario. It fails if either the given path to the DBC file doesn’t exist or the given message name is not found within the test environment.
Also, a created CAN Message Object cannot exist without the context of a specific CAN network, so the third parameter of this keyword is network_name
, and the message can only exist within this network. You can’t change this parameter of the object after creation. The fourth mandatory parameter is source_address
. This parameter is part of the CAN ID, so it is also used to identify the CAN message when it is received.
The set of arguments and their order when calling Create Message Keyword is:
dbc_name - The relative path to the DBC-file on SDR where the message is defined.
message_name - The unique name of the message in the scope of the DBC-file.
network_name - The unique name of the network in which the message is transmitted.
source_address - The network identifier of the message’s transmitter. This parameter is optional. In the context of CAN messages, the source address may be embedded within the identifier field, especially in simpler networks or when using the extended CAN format. For J1939 protocol, the source address is part of the 29-bit identifier but can sometimes be inferred from the Parameter Group Number (PGN) or the context of the communication. Therefore, explicitly specifying the source address may not always be necessary.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message). This parameter is optional. If omitted, the message will be broadcasted to all nodes within the specified network. In the context of CAN and J1939 protocols, specifying the destination address allows for directed communication, whereas omitting it enables broadcasting, making the message available to all nodes on the network.
Example usage of Create Message Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can create broadcasted message
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
Should Be Equal ${msg}[dbc_name] IOCC_ECU.dbc
Should Be Equal ${msg}[message_name] MeasuredTemp
Should Be Equal ${msg}[network_name] LftReZone
Should Be Equal ${msg}[source_address] ${0x01}
Should Be Equal ${msg}[destination_address] ${0xFF}
User can create unicasted message
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01} ${0x0A}
Should Be Equal ${msg}[destination_address] ${0x0A}
User can't create message because DBC-file doesn't exist
TRY
${msg} = Create Message ${Empty} MeasuredTemp LftReZone ${0x01}
EXCEPT The DBC-file '' doesn't exist within the XIL Server.
Should Be True ${True}
END
User can't create message because message name doesn't exist
TRY
${msg} = Create Message IOCC_ECU.dbc ${Empty} LftReZone ${0x01}
EXCEPT The message '' doesn't exist within the specified DBC-file 'IOCC_ECU.dbc'.
Should Be True ${True}
END
User can't create message because network doesn't exist
TRY
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp ${Empty} ${0x01}
EXCEPT The network '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
User can't create message because source address doesn't exist
TRY
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${Empty}
EXCEPT The network identifier of the transmitter '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
The following exceptions may occur when Create Message Keyword is calling:
The specified DBC-file
{dbc_name}
doesn’t exist within the XIL Server.The specifed message
{message_name}
doesn’t exist within specified DBC-file{dbc_name}
.The specified network
{network_name}
doesn’t exist within current XIL Test Environment.The network identifier of the transmitter
{source_address}
doesn’t exist within current XIL Test Environment.
2.3.3. Create E2E Message Keyword
Create E2E Message Keyword creates a CAN message with additional E2E protection parameters (data_id and profile) in the context of a test scenario. This keyword is similar to Create Message Keyword, but it also includes additional parameters required for E2E protection.
The set of arguments and their order when calling Create E2E Message Keyword is:
dbc_name - The relative path to the DBC-file on SDR where the message is defined.
message_name - The unique name of the message in the scope of the DBC-file.
network_name - The unique name of the network in which the message is transmitted.
source_address - The network identifier of the message’s transmitter. This parameter is optional. In the context of CAN messages, the source address may be embedded within the identifier field, especially in simpler networks or when using the extended CAN format. For J1939 protocol, the source address is part of the 29-bit identifier but can sometimes be inferred from the Parameter Group Number (PGN) or the context of the communication. Therefore, explicitly specifying the source address may not always be necessary.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message). This parameter is optional. If omitted, the message will be broadcasted to all nodes within the specified network. In the context of CAN and J1939 protocols, specifying the destination address allows for directed communication, whereas omitting it enables broadcasting, making the message available to all nodes on the network.
data_id - The identifier for the data to be protected by E2E.
profile - The E2E profile to be used for protection.
Example usage of Create E2E Message Keyword:
robotframework
Copy code
`*** Settings *** Library lib/SodaKeywordsLibrary.py
*** Test Cases *** User can create an E2E protected message ${msg} = Create E2E Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01} ${0x0A} ${0x001} ${0x1A} Should Be Equal ${msg}[dbc_name] IOCC_ECU.dbc Should Be Equal ${msg}[message_name] MeasuredTemp Should Be Equal ${msg}[network_name] LftReZone Should Be Equal ${msg}[source_address] ${0x01} Should Be Equal ${msg}[destination_address] ${0x0A} Should Be Equal ${msg}[data_id] ${0x001} Should Be Equal ${msg}[profile] ${0x1A}
User can’t create E2E message because DBC-file doesn’t exist TRY ${msg} = Create E2E Message ${Empty} MeasuredTemp LftReZone ${0x01} ${0x0A} ${0x001} ${0x1A} EXCEPT The DBC-file ‘’ doesn’t exist within the XIL Server. Should Be True ${True} END
User can’t create E2E message because message name doesn’t exist TRY ${msg} = Create E2E Message IOCC_ECU.dbc ${Empty} LftReZone ${0x01} ${0x0A} ${0x001} ${0x1A} EXCEPT The message ‘’ doesn’t exist within the specified DBC-file ‘IOCC_ECU.dbc’. Should Be True ${True} END
User can’t create E2E message because network doesn’t exist TRY ${msg} = Create E2E Message IOCC_ECU.dbc MeasuredTemp ${Empty} ${0x01} ${0x0A} ${0x001} ${0x1A} EXCEPT The network ‘’ doesn’t exist within the XIL Test Environment. Should Be True ${True} END
User can’t create E2E message because source address doesn’t exist TRY ${msg} = Create E2E Message IOCC_ECU.dbc MeasuredTemp LftReZone ${Empty} ${0x0A} ${0x001} ${0x1A} EXCEPT The network identifier of the transmitter ‘’ doesn’t exist within the XIL Test Environment. Should Be True ${True} END`
The following exceptions may occur when calling Create E2E Message Keyword:
The specified DBC-file
{dbc_name}
doesn’t exist within the XIL Server.The specified message
{message_name}
doesn’t exist within the specified DBC-file{dbc_name}
.The specified network
{network_name}
doesn’t exist within the current XIL Test Environment.The network identifier of the transmitter
{source_address}
doesn’t exist within the current XIL Test Environment.
2.3.4. Apply Message Keyword
Apply Message Keyword applies changes of a CAN Message Object to the test environment. All changes will be applied atomically, so the receivers will never get a partial update; only the whole consistent CAN message will be sent.
The set of argruments and and their order when calling Apply Message Keyword is next:
message - The CAN Message Object in the context of test scenario which corresponds to CAN message in the test environment.
The example of using Apply Message Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can modify message and apply these changes on XIL Server
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
Should Be Equal ${msg}[cycle_time] ${100}
Should Be Equal ${msg}[InnerTemperature] ${5}
Should Be Equal ${msg}[AmbientTemprature] ${25}
Should Be Equal ${msg}[FanSpeedMode] NORMAL
${msg}[cycle_time] = Set Variable ${200}
${msg}[InnerTemperature] = Set Variable ${20}
${msg}[AmbientTemprature] = Set Variable ${10}
${msg}[FanSpeedMode] = Set Variable LOW
${msg_modified} = Apply message ${msg}
Should Be Equal ${msg_modified}[cycle_time] ${200}
Should Be Equal ${msg_modified}[InnerTemperature] ${20}
Should Be Equal ${msg_modified}[AmbientTemprature] ${10}
Should Be Equal ${msg_modified}[FanSpeedMode] LOW
User can't modify message because the signal doesn't exist
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
${msg}[CargoTemprature] = Set Variable ${10}
TRY
${msg_modified} = Apply Message ${msg}
EXCEPT The signal 'CargoTemprature' doesn't exist within the specified message 'MeasuredTemp'.
Should Be True ${True}
END
The following exceptions may occur when Apply Message Keyword is calling:
The signal
{signal_name}
doesn’t exist within the specified message{message_name}
.
2.3.5. Set Signal Value Keyword
Set Signal Value Keyword is used to modify one signal within a transmitted CAN message. Behind the scenes, the keyword gets the CAN message, modifies one signal within this message, and then applies the modified message to the test environment.
The set of argruments and and their order when calling Set Signal Value Keyword is next:
message_name - The unique name of the message that is currently being transmitted on the specified CAN network.
network_name - The unique name of the CAN network within the test environment in which the message is transmitted.
signal_name - The unique name of the signal in scope of the specified message.
signal_value - The new value of the signal which will start transmitted immediately after execution of the keyword.
source_address - The network identifier of the message’s transmitter. This parameter is optional. In the context of CAN messages, the source address may be embedded within the identifier field, especially in simpler networks or when using the extended CAN format. For J1939 protocol, the source address is part of the 29-bit identifier but can sometimes be inferred from the Parameter Group Number (PGN) or the context of the communication. Therefore, explicitly specifying the source address may not always be necessary.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message). This parameter is optional. If omitted, the message will be broadcasted to all nodes within the specified network. In the context of CAN and J1939 protocols, specifying the destination address allows for directed communication, whereas omitting it enables broadcasting, making the message available to all nodes on the network. The example of using Set Signal Value Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can modify signal within the transmitted message on XIL Server
${msg} = Set Signal Value MeasuredTemp LftReZone AmbientTemprature ${30} ${0x01}
Should Be Equal ${msg}[AmbientTemprature] ${30}
User can't modify signal because the message isn't transmitted
TRY
${msg} = Set Signal Value '' LftReZone AmbientTemprature ${30} ${0x01}
EXCEPT The message '' isn't transmitted within the specified network 'LftReZone'
Should Be True ${True}
END
User can't modify signal because the network doesn't exist
TRY
${msg} = Set Signal Value MeasuredTemp '' AmbientTemprature ${30} ${0x01}
EXCEPT The network '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
User can't modify siganl becuase it doesn't exist
TRY
${msg} = Set Signal Value MeasuredTemp LftReZone CargoTemprature ${30} ${0x01}
EXCEPT The signal 'CargoTemprature' doesn't exist within the specified message 'MeasuredTemp'.
Should Be True ${True}
END
The following exceptions may occur when Set Signal Value Keyword is calling:
The message
{message_name}
isn’t transmitted within the specified network{network_name}
.The network
{network_name}
doesn’t exist within the XIL Test Environment.The network identifier of the transmitter
{source_address}
doesn’t exist within the XIL Test Environment.The signal
{signal_name}
doesn’t exist within the specified message{message_name}
.
2.3.6. Get Signal Value Keyword
Get Signal Value Keyword retrieves a signal from a CAN message which is transmitted within a specific CAN network as a variable in the context of the test scenario.
The set of argruments and their order when calling Get Signal Value Keyword is next:
message_name - The unique name of the message that is currently being transmitted on the specified CAN network.
network_name - The unique name of the CAN network within the test environment in which the message is transmitted.
signal_name - The unique name of the signal in scope of the specified message.
source_address - The network identifier of the message’s transmitter. This parameter is optional. In the context of CAN messages, the source address may be embedded within the identifier field, especially in simpler networks or when using the extended CAN format. For J1939 protocol, the source address is part of the 29-bit identifier but can sometimes be inferred from the Parameter Group Number (PGN) or the context of the communication. Therefore, explicitly specifying the source address may not always be necessary.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message). This parameter is optional. If omitted, the message will be broadcasted to all nodes within the specified network. In the context of CAN and J1939 protocols, specifying the destination address allows for directed communication, whereas omitting it enables broadcasting, making the message available to all nodes on the network.
The example of using Get Signal Value Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can retrieve signal within the transmitted message on XIL Server
${ambientT} = Get Signal Value MeasuredTemp BodyNet AmbientTemprature ${0x01}
Should Be Equal ${ambientT} ${30}
User can't retrieve signal because the message isn't transmitted
TRY
${ambientT} = Get Signal Value '' LftReZone AmbientTemprature ${0x01}
EXCEPT The message '' isn't transmitted within the specified network 'LftReZone'
Should Be True ${True}
END
User can't retrieve signal because the network doesn't exist
TRY
${ambientT} = Get Signal Value MeasuredTemp '' AmbientTemprature ${0x01}
EXCEPT The network '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
User can't retrieve signal becuase it doesn't exist
TRY
${ambientT} = Get Signal Value MeasuredTemp LftReZone CargoTemprature ${0x01}
EXCEPT The signal 'CargoTemprature' doesn't exist within the specified message 'MeasuredTemp'.
Should Be True ${True}
END
The following exceptions may occur when Get Signal Value Keyword is calling:
The message
{message_name}
isn’t transmitted within the specified network{network_name}
.The network
{network_name}
doesn’t exist within the XIL Test Environment.The network identifier of the transmitter
{source_address}
doesn’t exist within the XIL Test Environment.The signal
{signal_name}
doesn’t exist within the specified message{message_name}
.
2.3.7. Get Message Keyword
Get Message Keyword retrieves a CAN message that is being transmitted at the current moment within a specific CAN network as a CAN Message Object in the context of the test scenario. In other words, you can only get a CAN message that exists right now in the CAN network within the current test environment. The keyword returns an empty object if the specified CAN message is not being transmitted in the CAN network at the time of the request.
The set of argruments and and their order when calling Get Message Keyword is next:
message_name - The unique name of the message that is currently being transmitted on the specified CAN network.
network_name - The unique name of the CAN network within the test environment in which the message is transmitted.
source_address - The network identifier of the message’s transmitter. This parameter is optional. In the context of CAN messages, the source address may be embedded within the identifier field, especially in simpler networks or when using the extended CAN format. For J1939 protocol, the source address is part of the 29-bit identifier but can sometimes be inferred from the Parameter Group Number (PGN) or the context of the communication. Therefore, explicitly specifying the source address may not always be necessary.
destination_address - The network identifier of the message’s receiver (destination point of the transmitted message). This parameter is optional. If omitted, the message will be broadcasted to all nodes within the specified network. In the context of CAN and J1939 protocols, specifying the destination address allows for directed communication, whereas omitting it enables broadcasting, making the message available to all nodes on the network.
The example of using Get Message Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get message which is currently transmtted
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
Start Message ${msg}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Not Be Empty ${msg}
Stop Message ${msg}
User can't get message becuase the message isn't transmitted
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Be Empty ${msg}
User can't get message because the network doesn't exist
TRY
${msg} = Get Message MeasuredTemp ${Empty} ${0x01}
EXCEPT The network '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
User can't get message because source address doesn't exist
TRY
${msg} = Get Message MeasuredTemp LftReZone ${Empty}
EXCEPT The network identifier of the transmitter '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
The following exceptions may occur when Get Message Keyword is calling:
The network
{network_name}
doesn’t exist within the XIL Test Environment.The network identifier of the transmitter
{source_address}
doesn’t exist within the XIL Test Environment.
2.3.8. Start Message Keyword
Start Message Keyword starts transmission of a specified CAN message within a specified CAN network in the test envaironment. After the CAN message was started, you can using Get Message Keyword returns CAN Message Object which contains all needed information about previously started CAN message within the network.
Start Message Keyword initiates the transmission of a specified CAN message within a specified CAN network in the test environment. After the CAN message has been started, you can use the Get Message Keyword to retrieve a CAN Message Object which contains all necessary information about the previously started CAN message within the network.
The set of argruments and and their order when calling Start Message Keyword is next:
message - The CAN Message Object in the context of test scenario which corresponds to CAN message in the test environment.
The example of using Start Message Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can start message
Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Be Empty ${msg}
Start Message ${msg}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Not Be Empty ${msg}
2.3.9. Stop Message Keyword
Stop Message Keyword stops transmission of a specified CAN message within a specified Network. After the message was stopped, Get Message Keyword returns empty object.
The set of argruments and and their order when calling Stop Message Keyword is next:
message - The CAN Message Object in the context of test scenario which corresponds to CAN message in the test environment.
The example of using Stop Message Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can stop message
${msg} = Create Message IOCC_ECU.dbc MeasuredTemp LftReZone ${0x01}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Be Empty ${msg}
Start Message ${msg}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Not Be Empty ${msg}
Stop Message ${msg}
${msg} = Get Message MeasuredTemp LftReZone ${0x01}
Should Be Empty ${msg}
2.4. Interacting with ECU Pins
This section describes the keywords used to interact with ECU pins as presented in the test environment.
2.4.1. Get Pin Voltage Keyword
Get Pin Voltage Keyword returns a scalar value in Volts which corresponds to the voltage on a specified ECU pin. The obtained value can range from 0-27V
, with an accuracy of 0.015V
from the expected value. It fails if either the given ECU or its pin name does not exist within the current test environment.
The set of argruments and and their order when calling Get Pin Voltage Keyword is next:
ecu_name - The unique name of the ECU within the test environment. For example, it could be LftReEcu or LRIO.
pin_name - The unique name of the pin in the format
{identifier of electrical connector}.{number of pin in specified connector}
in the scope of the specified ECU. For example, it could be X1.11, which means the electrical connector is X1, and the number of the pin is 11.
The example of using Get Pin Voltage Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get voltage of the pin
${accuracy} = Set Variable ${0.015}
${expected_voltage} = Set Variable ${10}
${actual_voltage} = Get Pin Voltage LRIO X1.11
Should Be True abs(${expected_voltage} - ${actual_voltage}) <= ${accuracy}
User can't get voltage because the ECU doesn't exist
TRY
Get Pin Voltage ${Empty} X1.11
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't get voltage because the pin doesn't exist
TRY
Get Pin Voltage LRIO ${Empty}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Get Pin Voltage Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.4.2. Set Pin Voltage Keyword
Set Pin Voltage Keyword sets the voltage of a specified ECU pin to a new value. The permissible voltage range that can be set on the pin is 0-27V
. It fails if either the given ECU or pin name does not exist within the current test environment. An exception will also be thrown if the set value exceeds the permissible range.
The set of arguments and their order when calling Set Pin Voltage Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.voltage - The value of voltage in
Volts
which will be set on the specified ECU pin. The available range of voltage is0-27V
.
The example of using Set Pin Voltage Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and get voltage on the pin
${accuracy} = Set Variable ${0.015}
${expected_voltage} = Set Variable ${10}
Set Pin Voltage LRIO X1.12 ${expected_voltage}
${actual_voltage} = Get Pin Voltage LRIO X1.11
Should Be True abs(${expected_voltage} - ${actual_voltage}) <= ${accuracy}
User can't set voltage because the voltage is more than max
TRY
Set Pin Voltage LRIO X1.12 ${35}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested voltage value '35' is out of the range '0-27V'.
END
User can't set voltage because the voltage is less than min
TRY
Set Pin Voltage LRIO X1.12 ${-5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested voltage value '-5' is out of the range '0-27V'.
END
User can't set voltage because the ECU doesn't exist
TRY
Set Pin Voltage ${Empty} X1.12 ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't set voltage because the pin doesn't exist
TRY
Set Pin Voltage LRIO ${Empty} ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Set Pin Voltage Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
The requested voltage value ‘{voltage}’ is out of the range ‘0-27V’.
2.4.3. Should Be Equal Pin Voltage Keyword
Should Be Equal Pin Voltage Keyword is used to measure and subsequently compare the voltage on an ECU pin with the specified value. If the current voltage does not match the set value, an exception will be triggered.
The set of arguments and their order when calling Should Be Equal Pin Voltage Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.voltage - The value of voltage in Volts which will be compared with the measured value on the specified ECU pin. If the measured voltage isn’t equal to the specified value, the exception is raised. The available range of voltage is
0-27V
.precision - The precision value in percentage or absolute value depending on the precision mode.
timeout_s - The timeout in seconds to wait for the voltage to be set to the specified value.
precision_mode - The mode of precision comparison. It can be one of the following:
RELRANGE
- Relative range precision. This is default option.RELVALUE
- Relative value precision.ABSVALUE
- Absolute value precision.
The example of using Set Pin Voltage Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and validate voltage on the pin
${pin_voltage} = Set Variable ${10}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Voltage LRIO X1.12 ${pin_voltage}
Should Be Equal Pin Voltage LRIO X1.12 ${pin_voltage} ${precision} ${timeout_s} ${precision_mode}
User can set and raise pin voltage validation exception
${pin_voltage} = Set Variable ${10}
${wrong_voltage} = Set Variable ${5}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Voltage LRIO X1.12 ${pin_voltage}
TRY
Should Be Equal Pin Voltage LRIO X1.12 ${wrong_voltage} ${precision} ${timeout_s} ${precision_mode}
FAIL Expected an exception to be raised, but none was.
EXCEPT ${error}
Log ${error}
Should Contain ${error} The specified voltage '10' doesn't match the current value of the pin
END
The following exceptions may occur when Should Be Equal Pin Voltage Keyword is calling:
The specified voltage ‘{voltage}’ doesn’t match the current value of the pin, which is ‘{actual_voltage}’.
2.4.4. Get Pin Current Loop Keyword
Get Pin Current Loop Keyword returns a scalar value in mA
which corresponds to the current loop of a specified ECU pin. The possible range of current is 0-20mA
, with an accuracy of 0.02mA
from the expected value. It fails if either the given ECU or pin name does not exist within the current test environment.
The set of arguments and their order when calling Get Pin Current Loop Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.
The example of using Get Pin Current Loop Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get current loop of the pin
${accuracy} = Set Variable ${0.015}
${expected_current_loop} = Set Variable ${10}
${actual_current_loop} = Get Pin Current Loop LRIO X1.11
Should Be True abs(${expected_current_loop} - ${actual_current_loop}) <= ${accuracy}
User can't get current loop because the ECU doesn't exist
TRY
Get Pin Current Loop ${Empty} X1.11
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't get current loop because the pin doesn't exist
TRY
Get Pin Current Loop LRIO ${Empty}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Get Pin Current Loop Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.4.5. Set Pin Current Loop Keyword
Set Pin Current Loop Keyword sets the current loop of a specified ECU pin to a new value. The permissible current loop range that can be set on the pin is 0-20mA
. It fails if either the given ECU or pin name does not exist within the current test environment. An exception will also be thrown if the set value exceeds the permissible range.
The set of arguments and their order when calling Set Pin Current Loop Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.current_loop - The value of current loop in
mA
which will be set on the specified ECU pin. The available range of current loop is0-20mA
.
The example of using Set Pin Current Loop Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set current loop on the pin
${accuracy} = Set Variable ${0.02}
${expected_current_loop} = Set Variable ${10}
Set Pin Current Loop LRIO X1.12 ${expected_current_loop}
${actual_current_loop} = Get Pin Current Loop LRIO X1.11
Should Be True abs(${expected_current_loop} - ${actual_current_loop}) <= ${accuracy}
User can't set current loop because the value is more than max
TRY
Set Pin Current Loop LRIO X1.12 ${25}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested current loop value '25' is out of the range '0-20mA'.
END
User can't set current loop because the value is less than min
TRY
Set Pin Current Loop LRIO X1.12 ${-5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested current loop value '-5' is out of the range '0-20mA'.
END
User can't set current loop because the ECU doesn't exist
TRY
Set Pin Current Loop ${Empty} X1.12 ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't set current loop because the pin doesn't exist
TRY
Set Pin Current Loop LRIO ${Empty} ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Set Pin Current Loop Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
The requested current loop value ‘{current_loop}’ is out of the range ‘0-20mA’.
2.4.6. Should Be Equal Pin Current Loop Keyword
Should Be Equal Pin Current Loop Keyword is used to measure and subsequently compare the current loop on an ECU pin with the specified value. If the actual value of the current loop does not match the set value, an exception will be triggered.
The set of arguments and their order when calling Should Be Equal Pin Current Loop Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.current_loop - The value of the current loop in
mA
, which will be compared with the measured value on the specified ECU pin. If the measured current loop isn’t equal to the specified value, the exception is raised. The available range of the current loop is0-20mA
.precision - The precision value in percentage or absolute value depending on the precision mode.
timeout_s - The timeout, in seconds, to wait for the current loop to be measured and then compared with the specified value.
precision_mode - The mode of precision comparison. It can be one of the following:
RELRANGE
- Relative range precision. This is default option.RELVALUE
- Relative value precision.ABSVALUE
- Absolute value precision.
The example of using Should Be Equal Pin Current Loop Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and validate current loop on the pin
${pin_current_loop} = Set Variable ${10}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Current Loop LRIO X1.12 ${pin_current_loop}
Should Be Equal Pin Current Loop LRIO X1.12 ${pin_current_loop} ${precision} ${timeout_s} ${precision_mode}
User can set and raise pin current loop validation exception
${pin_current_loop} = Set Variable ${10}
${wrong_current_loop} = Set Variable ${5}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Current Loop LRIO X1.12 ${pin_current_loop}
TRY
Should Be Equal Pin Current Loop LRIO X1.12 ${wrong_current_loop} ${precision} ${timeout_s} ${precision_mode}
FAIL Expected an exception to be raised, but none was.
EXCEPT ${error}
Log ${error}
Should Contain ${error} The specified current loop '10' doesn't match the actual value of the pin
END
The following exceptions may occur when Should Be Equal Pin Current Loop Keyword is calling:
The specified current loop ‘{expected_current_loop}’ doesn’t match the actual value of the pin, which is ‘{actual_current_loop}’.
2.4.7. Get Pin PWM Keyword
Get Pin PWM Keyword returns a dictionary object into the context of the test scenario, which corresponds to the PWM settings on a specified ECU pin. The possible range of the frequency is [0-50000Hz]
, with an accuracy of 1Hz
from the expected value. It fails if either the given ECU or pin name does not exist within the current test environment.
The set of arguments and their order when calling Get Pin PWM Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.
The example of using Get Pin PWM Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get PWM of the pin
${accuracy} = Set Variable ${1}
${expected_frequency} = Set Variable ${10000}
${pin_pwm} = Get Pin PWM LRIO X1.11
Should Be True abs(${expected_frequency} - ${pin_pwm}[frequency]) <= ${accuracy}
Should Be Equal ${pin_pwm}[duty] ${100}
Should Be Equal ${pin_pwm}[level] ${15}
User can't get PWM because the ECU doesn't exist
TRY
Get Pin PWM ${Empty} X1.11
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't get PWM because the pin doesn't exist
TRY
Get Pin PWM LRIO ${Empty}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Get Pin PWM Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.4.8. Set Pin PWM Keyword
Set Pin PWM Keyword sets PWM for a specified ECU pin to a new settings. The permissible frequency range that can be set on the pin is [0-50000Hz]
. It fails if either the given ECU or pin name does not exist within the current test environment. An exception will also be thrown if the set values exceeds the permissible ranges.
The set of arguments and their order when calling Set Pin PWM Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.duty - The settings of Pulse Width Modulation on the specified ECU pin. It allows control of the power supplied to electrical devices by varying the duty cycle of a digital (on/off) pulse train. The available range of PWM duty is
[0-100%]
.frequency - The settings of Pulse Width Modulation on the specified ECU pin. It allows control of the power supplied to electrical devices by varying the duty cycle of a digital (on/off) pulse train. The available range of PWM frequency is
[0-50000Hz]
.level - The settings of Pulse Width Modulation on the specified ECU pin. It allows control of the power supplied to electrical devices by varying the duty cycle of a digital (on/off) pulse train. The available range of PWM level is
[0-27V]
.
The example of using Set Pin PWM Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set PWM of the pin
${accuracy} = Set Variable ${1}
${expected_frequency} = Set Variable ${10000}
Set Pin PWM LRIO X1.12 ${100} ${expected_frequency} ${15}
${pin_pwm} = Get Pin PWM LRIO X1.12
Should Be True abs(${expected_frequency} - ${pin_pwm}[frequency]) <= ${accuracy}
Should Be Equal ${pin_pwm}[duty] ${100}
Should Be Equal ${pin_pwm}[level] ${15}
User can't set PWM because the ECU doesn't exist
TRY
Set Pin PWM ${Empty} X1.12 ${100} ${30000} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't set PWM because the pin doesn't exist
TRY
Set Pin PWM LRIO ${Empty} ${100} ${30000} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
User can't set PWM duty because the value is more than max
TRY
Set Pin PWM LRIO X1.12 ${150} ${30000} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM duty value '150' is out of the range '0-100%'.
END
User can't set PWM duty because the value is less than min
TRY
Set Pin PWM LRIO X1.12 ${-50} ${30000} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM duty value '-50' is out of the range '0-100%'.
END
User can't set PWM frequency because the value is more than max
TRY
Set Pin PWM LRIO X1.12 ${100} ${60000} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM frequency value '60000' is out of the range '0-50000Hz'.
END
User can't set PWM frequency because the value is less than min
TRY
Set Pin PWM LRIO X1.12 ${100} ${-30} ${15}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM frequency value '-30' is out of the range '0-50000Hz'.
END
User can't set PWM level because the value is more than max
TRY
Set Pin PWM LRIO X1.12 ${100} ${30000} ${45}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM level value '45' is out of the range '0-27V'.
END
User can't set PWM level because the value is less than min
TRY
Set Pin PWM LRIO X1.12 ${100} ${30000} ${-5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested PWM level value '-5' is out of the range '0-27V'.
END
The following exceptions may occur when Set Pin PWM Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
The requested PWM duty value ‘{duty}’ is out of the range ‘0-100%’.
The requested PWM frequency value ‘{frequency}’ is out of the range ‘0-50000Hz’.
The requested PWM level value ‘{level}’ is out of the range ‘0-27V’.
2.4.9. Should Be Equal Pin PWM Duty Keyword
Should Be Equal Pin PWM Duty Keyword is used to measure and subsequently compare the PWM duty on an ECU pin with the specified value. If the actual value of the PWM duty does not match the set value, an exception will be triggered.
The set of arguments and their order when calling Should Be Equal Pin PWM Duty Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.duty - The duty cycle value in percentage which will be compared with the measured value on the specified ECU pin. If the measured duty cycle isn’t equal to the specified value, the exception is raised. The available range of duty is
0-100%
.precision - The precision value in percentage or absolute value depending on the precision mode for the duty cycle.
timeout_s - The timeout, in seconds, to wait for the PWM duty to be measured and then compared with the specified value.
precision_mode - The mode of precision comparison. It can be one of the following:
RELRANGE
- Relative range precision.RELVALUE
- Relative value precision.ABSVALUE
- Absolute value precision.
The example of using Should Be Equal Pin PWM Duty Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and validate PWM duty on the pin
${pin_pwm_duty} = Set Variable ${50}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin PWM LRIO X1.12 ${pin_pwm_duty} ${10000} ${15}
Should Be Equal Pin PWM Duty LRIO X1.12 ${pin_pwm_duty} ${precision} ${timeout_s} ${precision_mode}
User can set and raise pin PWM duty validation exception
${pin_pwm_duty} = Set Variable ${50}
${wrong_pwm_duty} = Set Variable ${10}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin PWM LRIO X1.12 ${pin_pwm_duty} ${10000} ${15}
TRY
Should Be Equal Pin PWM Duty LRIO X1.12 ${wrong_pwm_duty} ${precision} ${timeout_s} ${precision_mode}
FAIL Expected an exception to be raised, but none was.
EXCEPT ${error}
Log ${error}
Should Contain ${error} The specified PWM duty '10' doesn't match the actual value of the pin
END
The following exceptions may occur when Should Be Equal Pin PWM Duty Keyword is calling:
The specified PWM duty ‘{expected_pwm_duty}’ doesn’t match the actual value of the pin, which is ‘{actual_pwm_duty}’.
2.4.10. Should Be Equal Pin PWM Frequency Keyword
Should Be Equal Pin PWM Frequency Keyword is used to measure and subsequently compare the PWM frequency on an ECU pin with the specified value. If the actual value of the PWM frequency does not match the set value, an exception will be triggered.
The set of arguments and their order when calling Should Be Equal Pin PWM Frequency Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.frequency - The frequency value in
Hz
which will be compared with the measured value on the specified ECU pin. If the measured frequency isn’t equal to the specified value, the exception is raised. The available range of frequency is[0-50000Hz]
.precision - The precision value in percentage or absolute value depending on the precision mode for the PWM frequency.
timeout_s - The timeout, in seconds, to wait for the PWM frequency to be measured and then compared with the specified value.
precision_mode - The mode of precision comparison. It can be one of the following:
RELRANGE
- Relative range precision.RELVALUE
- Relative value precision.ABSVALUE
- Absolute value precision.
The example of using Should Be Equal Pin PWM Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and validate PWM frequency on the pin
${pwm_frequency} = Set Variable ${10000}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin PWM LRIO X1.12 ${50} ${pwm_frequency} ${15}
Should Be Equal Pin PWM Frequency LRIO X1.12 ${pwm_frequency} ${precision} ${timeout_s} ${precision_mode}
User can set and raise pin PWM frequency validation exception
${pin_pwm_frequency} = Set Variable ${30000}
${wrong_pwm_frequency} = Set Variable ${10000}
${precision} = Set Variable ${1}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin PWM LRIO X1.12 ${50} ${pin_pwm_frequency} ${15}
TRY
Should Be Equal Pin PWM Frequency LRIO X1.12 ${wrong_pwm_frequency} ${precision} ${timeout_s} ${precision_mode}
FAIL Expected an exception to be raised, but none was.
EXCEPT ${error}
Log ${error}
Should Contain ${error} The specified PWM frequency '10000' doesn't match the actual value of the pin
END
The following exceptions may occur when Should Be Equal Pin PWM Frequency Keyword is calling:
The specified PWM frequency ‘{expected_pwm_frequency}’ doesn’t match the actual value of the pin, which is ‘{actual_pwm_frequency}’.
2.4.11. Get Pin Current Keyword
Get Pin Current Keyword returns a scalar value in A
which corresponds to the current on a specified ECU pin. The possible range of current is 0-10A
, with an accuracy of 0.02A
from the expected value. It fails if either the given ECU or pin name does not exist within the current test environment.
The set of arguments and their order when calling Get Pin Current Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.
The example of using Get Pin Current Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get current of the pin
${accuracy} = Set Variable ${0.02}
${expected_current} = Set Variable ${5}
${actual_current} = Get Pin Current LRIO X1.11
Should Be True abs(${expected_current} - ${actual_current}) <= ${accuracy}
User can't get current because the ECU doesn't exist
TRY
Get Pin Current ${Empty} X1.11
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't get current because the pin doesn't exist
TRY
Get Pin Current LRIO ${Empty}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Get Pin Current Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.4.12. Set Pin Current Keyword
Set Pin Current Keyword sets the current of a specified ECU pin to a new value. The permissible current loop range that can be set on the pin is 0-10A
. It fails if either the given ECU or pin name does not exist within the current test environment. An exception will also be thrown if the set value exceeds the permissible range.
The set of arguments and their order when calling Set Pin Current Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.current - The value of current in
A
which will be set on the specified ECU pin. The available range of current is0-10A
.
The example of using Set Pin Current Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set current on the pin
${accuracy} = Set Variable ${0.02}
${expected_current} = Set Variable ${5}
Set Pin Current LRIO X1.12 ${expected_current}
${actual_current} = Get Pin Current LRIO X1.11
Should Be True abs(${expected_current} - ${actual_current}) <= ${accuracy}
User can't set current because the value is more than max
TRY
Set Pin Current LRIO X1.12 ${25}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested current value '25' is out of the range '0-10A'.
END
User can't set current because the value is less than min
TRY
Set Pin Current LRIO X1.12 ${-5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The requested current value '-5' is out of the range '0-10A'.
END
User can't set current because the ECU doesn't exist
TRY
Set Pin Current ${Empty} X1.12 ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't set current because the pin doesn't exist
TRY
Set Pin Current LRIO ${Empty} ${5}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Set Pin Current Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
The requested current value ‘{current}’ is out of the range ‘0-10A’.
2.4.13. Should Be Equal Pin Current Keyword
Should Be Equal Pin Current Keyword is used to measure and subsequently compare the current on an ECU pin with the specified value. If the actual value of the current does not match the set value, an exception will be triggered.
The set of arguments and their order when calling Should Be Equal Pin Current Keyword is next:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.current - The value of the current in
A
which will be compared with the measured value on the specified ECU pin. If the measured current isn’t equal to the specified value, the exception is raised. The available range of current is0-10A
.precision - The precision value in percentage or absolute value depending on the precision mode.
timeout_s - The timeout, in seconds, to wait for the current to be measured and then compared with the specified value.
precision_mode - The mode of precision comparison. It can be one of the following:
RELRANGE
- Relative range precision. This is default option.RELVALUE
- Relative value precision.ABSVALUE
- Absolute value precision.
The example of using Should Be Equal Pin Current Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set and validate current on the pin
${pin_current} = Set Variable ${5}
${precision} = Set Variable ${0.5}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Current LRIO X1.12 ${pin_current}
Should Be Equal Pin Current LRIO X1.12 ${pin_current} ${precision} ${timeout_s} ${precision_mode}
User can set and raise pin current validation exception
${pin_current} = Set Variable ${5}
${wrong_current} = Set Variable ${3}
${precision} = Set Variable ${0.5}
${timeout_s} = Set Variable ${3}
${precision_mode} = Set Variable RELVALUE
Set Pin Current LRIO X1.12 ${pin_current}
TRY
Should Be Equal Pin Current LRIO X1.12 ${wrong_current} ${precision} ${timeout_s} ${precision_mode}
FAIL Expected an exception to be raised, but none was.
EXCEPT ${error}
Log ${error}
Should Contain ${error} The specified current '3' doesn't match the actual value of the pin
END
The following exceptions may occur when Should Be Equal Pin Current Keyword is calling:
The specified current ‘{expected_current}’ doesn’t match the actual value of the pin, which is ‘{actual_current}’.
2.4.14. Get Pin Din Keyword
Get Pin Din Keyword returns the digital input state of a specified ECU pin. The possible states are High
or Low
. It fails if either the given ECU or pin name does not exist within the current test environment.
The set of arguments and their order when calling Get Pin Din Keyword is:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.
The example of using Get Pin Din Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get digital input state of the pin
${pin_din} = Get Pin Din LRIO X1.11
Should Be Equal ${pin_din} High
User can't get digital input state because the ECU doesn't exist
TRY
Get Pin Din ${Empty} X1.11
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't get digital input state because the pin doesn't exist
TRY
Get Pin Din LRIO ${Empty}
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Get Pin Din Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.4.15. Set Pin Dout Keyword
Set Pin Dout Keyword sets the digital output state of a specified ECU pin to a new value. The possible states are High
or Low
. It fails if either the given ECU or pin name does not exist within the current test environment.
The set of arguments and their order when calling Set Pin Dout Keyword is:
ecu_name - The unique name of ECU within the test environment. For example, it could be
LftReEcu
orLRIO
.pin_name - The unique name of Pin in format
{identifier of electrical connector}.{number of pin in specified connector}
in scope of specified ECU. For example, it could beX1.11
this means the electrical connector isX1
and the number of Pin is11
.state - The digital output state to set on the specified ECU pin. The possible states are
High
orLow
.
The example of using Set Pin Dout Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set digital output state on the pin
${pin} = Set Pin Dout LRIO X1.12 High
Should Be Equal ${pin}[state] High
User can't set digital output state because the ECU doesn't exist
TRY
Set Pin Dout ${Empty} X1.12 High
EXCEPT ${error}
Log ${error}
Should Contain ${error} The ECU '' doesn't exist within the XIL Test Environment.
END
User can't set digital output state because the pin doesn't exist
TRY
Set Pin Dout LRIO ${Empty} High
EXCEPT ${error}
Log ${error}
Should Contain ${error} The pin '' of the specified ECU 'LRIO' doesn't exist.
END
The following exceptions may occur when Set Pin Dout Keyword is calling:
The ECU ‘{ecu_name}’ doesn’t exist within the XIL Test Environment.
The pin ‘{pin_name}’ of the specified ECU ‘{ecu_name}’ doesn’t exist.
2.5. Interacting with Simulation Models
2.5.1. Simulation Model Object
Simulation Model Object in the scope of a test scenario is a representation of an simulation model software component that is deployed and running within the configured test environment. This software component imitates an edge device that is sensed or actuated by control software running on ECUs. Using specific keywords, you can retrieve Simulation Model Object, change its parameters, and apply these changes back to the test environment. This object then allows you to interact with and manipulate the actual simulation model software component running in the test environment. This object has the following set of parameters:
simulation_model_name - The unique name of an simulation model software component within the test environment. The name consists of two parts - the simulation model template name which is specified in its specification file and the identifier of the simulation model instance which is defined when the simulation model is instantiated within a specific test environment. The following rules are used in simulation model name composition:
When the simulation model template has
multiple_instances = 'yes'
, you must specify both identifiers in the simulation model’s name. For example, if the identifier of the simulation model template isCrashSensImt
and there are two instances of this simulation model within the test environment -RearSensor
andFrontSensor
, the full names of these instances will beCrashSensImt/RearSensor
andCrashSensImt/FrontSensor
respectively.When the Simulation Model template has
multiple_instances = 'no'
, you can specify only the identifier of the template to identify the simulation model instance within the Test Environment. For example, if the identifier of the simulation model template isMbsmImt
and this simulation model can be instantiated only once, you can specify only MbsmImt as the simulation model’s name to get the instance.
template_name - The simulation model template name which is specified in its specification file.
instance_name - The identifier of the simulation model instance which is defined when the simulation model is instantiated within a specific test environment.
An simulation model software component can have a set of sender/receiver ports which are used to communicate with other software components via CAN networks. All its receiver ports marked with the flag is_handle='yes'
will be translated into parameters of the corresponding Simulation Model Object, and you will be able to modify them from a test scenario. All simulation model’s sender ports marked with the flag is_handle='yes'
will also be translated into parameters of the corresponding Simulation Model Object, but you can’t modify these parameters from the test scenario; otherwise, you will get an error when you try to apply these changes. You can only get values of such parameters and use them within the test scenario. In cases where receiver ports marked with the flag is_handle='yes'
have the payload as a CAN message, such ports will be translated into parameters of type dictionary object, where all parameters of this dictionary are based on internal signals of this message.
2.5.2. Get Simulation Model Keyword
Get Simulation Model Keyword gets a specific simulation model software component instance which is running within a test environment as Simulation Model Object to the test scenario context. It fails unless the given simulation model name exists within the test environment.
The set of argruments and and their order when calling Get Simulation Model Keyword is next:
simulation_model_name - The unique name of a simulation model software component within a test environment where this simulation model is deployed and running.
Let’s consider the example of Crash Sensor Simulation Model
which was instantiated twice within the test environment:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get specific instance of simulation model
${front_crash_sens} = Get simulation model CrashSensImt/FrontSensor
Should Be Equal ${front_crash_sens}[template_name] CrashSensImt
Should Be Equal ${front_crash_sens}[instance_name] FrontSensor
Let’s consider another example with MBMS Simulation Model
which was instantiated only once:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can get the imitatir by short name
${mbms_simulation_model} = Get Simulation Model MbmsImt
Should Be Equal ${mbms_simulation_model}[template_name] MbmsImt
Should Be Equal ${mbms_simulation_model}[instance_name] MbmsImt
User can't get the simulation model because it doesn't exist
TRY
Get Simulation Model ${Empty}
EXCEPT The simulation model '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
2.5.3. Apply Simulation Model Keyword
Apply Simulation Model Keyword restarts the execution of a specified simulation model software component with new input parameters. In other words, in a test scenario, you can modify the Simulation Model Object which represents the running simulation model, and then apply these changes to the test environment. As a result, the simulation model will be reinvoked with the new input parameters.
The set of argruments and and their order when calling Apply Simulation Model Keyword is next:
simulation_model - The Simulation Model Object in the context of test scenario which corresponds to a simulation model software component within the current test environment where this simulation model is deployed and running.
The example of using Apply Simulation Model Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can modify the simulation model and applay these changes
${stalks_imt1} = Get Simulation Model StrWhlStalksImt
${stalks_imt1}[HandleLftStalkAction] = Set Variable Wiper_Full_Push
${stalks_imt1}[HmiReq1][GS_Req] = Set Variable Park
${stalks_imt1}[FaultInjection][Fault_4] = Set Variable ${True}
${stalks_imt2} = Apply Simulation Model ${stalks_imt1}
Should Be Equal ${stalks_imt2}[HandleLftStalkAction] Wiper_Full_Push
Should Be Equal ${stalks_imt2}[HmiReq1][GS_Req] Park
Should Be Equal ${stalks_imt2}[FaultInjection][Fault_4] ${True}
User can't modify the simulation model because wrong parameters
${stalks_imt3} = Get Simulation Model StrWhlStalksImt
${stalks_imt3}[CrashEvt] = Set Variable ${True}
TRY
Apply Simulation Model ${stalks_imt3}
EXCEPT The simulation model 'StrWhlStalksImt' doesn't have the specified parameter 'CrashEvt'.
Should Be True ${True}
END
In this scenario the simulation model will be newly invoked with two new parameters HandleLftStalkAction = 'Wiper_Full_Push'
, HmiReq1['GS_Req'] = 'Park'
and FaultInjection['Fault_4'] = True
.
2.5.4. Set Simulation Model Value Keyword
Set Simulation Model Value Keyword is used to set only one parameter of a specified simulation model to a new value and then reinvoke the simulation model with this modified parameter in the current test environment.
The set of argruments and and their order when calling Set Simulation Model Value Keyword is next:
simulation_model_name - The unique name of a simulation model software component within a test environment where this simulation model is deployed and running.
param_name - The unique name of the simulation model’s parameter
param_value - The new value of the parameter with which the simulation model will be invoked immediately after execution of the keyword. All other parameters will be set to default values.
The example of using Set Simulation Model Value Keyword:
*** Settings ***
Library lib/SodaKeywordsLibrary.py
*** Test Cases ***
User can set value for simulation model's parameter
${front_crash_sens} = Set Simulation Model Value CrashSensImt/FrontSensor CrashEvt ${True}
Should Be Equal ${front_crash_sens}[CrashEvt] ${True}
User can't set value for simulation model's parameter because it doesn't exist
TRY
${front_crash_sens} = Set Simulation Model Value CrashSensImt/FrontSensor HandleLftStalkAction Wiper_Full_Push
EXCEPT The simulation model 'CrashSensImt/FrontSensor' doesn't have the specified parameter 'HandleLftStalkAction'.
Should Be True ${True}
END
User can't set value for simulation model's parameter because the simulation model doesn't exist
TRY
${front_crash_sens} = Set Simulation Model Value ${Empty} CrashEvt ${True}
EXCEPT The simulation model '' doesn't exist within the XIL Test Environment.
Should Be True ${True}
END
The following exceptions may occur when Set Simulation Model Value Keyword is calling:
The simulation model
{simulation_model_name}
doesn’t exist within the XIL Test Environment.The simulation model doesn’t have specified parameter.