TestConfigurationGlobalConstants¶
- class TestConfigurationGlobalConstants¶
Contains the global constants definition and references to global constants definition files.
Specifically for use in test configurations. See
GlobalConstantsfor a container to be used in project components.- AddArtifactReference(constantsReference)¶
Adds an artifact reference to a global constants definition file to the list.
- Parameters:
- constantsReference¶
Artifact reference to a global constants definition file
-
AppendReferencedFile(filename, namespace=
None)¶ Appends a global constants definition file at the end of the list of referenced global constants definition files.
- Parameters:
- filename : str¶
Path to the global constants definition file. Either absolute or relative. For non-library workspaces, a relative path is interpreted relative to the workspace directory. For library workspaces, a relative path is interpreted relative to the parameters directory.
- namespace : str¶
Identifier of the workspace to which a file path is resolved. If specified, the file reference is always created relative to the parameters directory of the workspace with the given ‘namespace’. For example, the namespace ‘myLibrary’ results in ‘<libraries.myLibrary.parameters>/MyConstants.gcd’. If None, ecu.test tries to find a matching library workspace based on the absolute or relative file path. If no matching library workspace was found, the file path is treated as relative to the current workspace directory.
- Raises:
ApiError – When the given file is already referenced in this test configuration
- ClearReferencedFiles()¶
Removes all referenced global constants definition files from the list.
- Clone()¶
Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.
- Returns:
A copy of this object
- Return type:
- GetArtifactReferences()¶
Returns artifact references to global constants definition files.
- Returns:
A list of all artifact references
- Return type:
list[
ArtifactReference]
- GetGlobalConstantsDefinition()¶
Returns the container for defining global constants statically.
- Returns:
Container for global constants
- Return type:
- GetReferencedFiles()¶
Returns a list of all referenced global constants definition files. The list is ordered by priority, i.e. global constants from files in the beginning of the list overwrite constants from later files. File references to a library workspace are always returned as an absolute path. Non-library workspace references are always returned relative to the workspace directory.
- Returns:
List of all referenced global constants definition files (*.gcd)
- Return type:
list[str]
- GetRestApiConstantsPriority()¶
Returns the priority of constants that are supplied during configuration start via the REST API with regard to the constants from referenced files and statically defined constants.
- Note:
This setting is only relevant if this object is referenced in a test configuration and if the configurations are started via REST API.
- Returns:
Priority value
- Return type:
int
- GetStaticConstantsPriority()¶
Returns the priority of statically defined constants with regard to the constants from referenced files and constants that are defined via REST API during configuration start.
- Returns:
Priority value
- Return type:
int
- RemoveArtifactReference(constantsReference)¶
Removes an artifact reference to a global constants definition file from the list.
- Parameters:
- constantsReference¶
Artifact reference to a global constants definition file
-
RemoveReferencedFile(filename, namespace=
None)¶ Removes a global constants definition file from the list of referenced global constants definition files.
- Parameters:
- filename : str¶
Path to the global constants definition file to be removed. Either absolute or relative. For non-library workspaces, a relative path is interpreted relative to the workspace directory. For library workspaces, a relative path is interpreted relative to the parameters directory.
- namespace : str¶
Identifier of the workspace to which a file path is resolved. If specified, the file reference is always created relative to the parameters directory of the workspace with the given ‘namespace’. For example, the namespace ‘myLibrary’ results in ‘<libraries.myLibrary.parameters>/MyConstants.gcd’. If None, ecu.test tries to find a matching library workspace based on the absolute or relative file path. If no matching library workspace was found, the file path is treated as relative to the current workspace directory.
- Raises:
ApiError – When the given file is not referenced in this test configuration
- SetRestApiConstantsPriority(priority)¶
Specifies the priority of the constants that are supplied during configuration start via the REST API with regard to the constants from referenced files and statically defined constants.
- Note:
If the given value is out of the valid range, it will be coerced to the closest reasonable value.
- Note:
This setting is only relevant if this object is referenced in a test configuration and if the configurations are started via REST API.
- Parameters:
- priority : int¶
Priority of the statically defined constants. Should be between
0: highest priority and
length of referenced files list + 1: lowest priority
- SetStaticConstantsPriority(priority)¶
Specifies the priority of the statically defined constants with regard to the constants from referenced files and constants that are defined via REST API during configuration start.
- Note:
If the given value is out of the valid range, it will be coerced to the closest reasonable value.
- Parameters:
- priority : int¶
Priority of the statically defined constants. Should be between
0: highest priority and
length of referenced files list + 1: lowest priority