TsPackage

class TsPackage

Represents a deprecated way to call subpackages. For most test cases those steps are migrated automatically. If not, this facade will be returned when reading the contents.

Deprecated:

Deprecated since version 2023.3: Please use CreateTsPackageCall instead. See MappingApi.CreatePackageMappingItem for creating a package mapping item.

AddTag(tag)

Add a specific tag to this step.

Parameters:
tag : str

The tag to be set

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:

TsPackage

DeleteTranslatedCommentText(language)

Deletes a comment for the test step in the given language.

Parameters:
language : str

Language of the text (‘en_US’, ‘de_DE’, ‘zh_CN’)

DisableReporting(disable=True)

Disables or enables the reporting this test step.

Parameters:
disable : boolean

If True the result of this test step will not be reported (optional)

DisableReportingFor(results)

Sets for which results reporting of the test step is disabled.

Parameters:
results : list[str]

List of results for which the test step will not be reported. Valid results are: u’NONE’, u’SUCCESS’, u’INCONCLUSIVE’, u’FAILED’, u’ERROR’

GetAbsolutePath()

Returns the absolute file path of the referenced package from a package call test step.

Returns:

Absolute file path of the package to be called.

Return type:

str

GetActionColumnText()

Returns the text value of the “action” column.

Returns:

Action column text

Return type:

str

GetComment()

Returns the comment of the test step in the current test case language.

Returns:

Comment text as shown in the comment tab

Return type:

str

GetCommentColumnText()

Returns the text value of the “comment” column.

Returns:

Comment column text

Return type:

str

GetError()

Returns a list of errors. Note that the error messages depend on the program language ecu.test is set to. Because of that we do not recommend to check against exact error messages, unless you are certain about the respective program language.

Returns:

List of errors

Return type:

list[str]

GetIndex()

Returns the zero based index in the parent.

Returns:

Zero based index

Return type:

integer

GetLineNo()

Returns the line number of the test step inside the test case.

Returns:

Line number of the test step

Return type:

int

GetMappingNames()

Returns the names of all mapping items mapped in the test step. Unmapped generic mappings of the called package are NOT returned.

Returns:

List of mapping names

Return type:

list[str]

GetMappingTarget(name)

Returns the target path of the mapping. This only works on mapping names mapped previously. (e.g. by calling SetMappingTarget) If there is no mapping of the given name, an ApiError is raised.

Parameters:
name : str

Name of the mapping

Returns:

Target path of the mapping

Return type:

str

Raises:

ApiError – If there is no mapping under the given name

GetPackageParameter(paramName)

Retrieves the expression assigned to a package parameter.

Parameters:
paramName : string

Name of the parameter

Returns:

Expression assigned to the parameter

Return type:

string

GetPackageParameters()

Retrieves all package parameters with its expressions.

Returns:

Dictionary with expressions assigned to the parameters

Return type:

dict[string, string]

GetPackageReturn(varInternal)

Retrieves the variable name assigned to a package return value.

Parameters:
varInternal : string

Name of the return variable in the called package

Returns:

Assigned variable of the calling package. Empty string if there is not any variable assigned.

Return type:

string

GetPackageReturns()

Retrieves the return value assignments.

Returns:

Assigned variables of the calling package

Return type:

dict[string, string]

GetParameterColumnText()

Returns the text value of the “parameter” column.

Returns:

Parameter column text

Return type:

str

GetParent()

Returns the parent test step.

Returns:

The parent test step or None if it is a top level test step.

Return type:

TestStep

GetPath()

Returns the file system path of the referenced package in a package call test step.

If this method returns a relative path, its base is the folder where the calling package is located, just like the path is shown in the package call test step’s dialog.

Returns:

File name with relative path of the package to be called.

Return type:

str

GetReferenceExpression()

Returns the expression that is used to determine which package should be called.

Returns:

The expression as a string as displayed in the test step dialog.

Return type:

str

GetReferencedPackage()

Returns the referenced package. If the path contains global constants, their current values are used.

Returns:

the referenced Package

Return type:

Package

GetReportDisablingResults()

Returns for which results reporting of the test step is disabled.

Returns:

List of results for which the test step will not be reported

Return type:

list[str]

GetTags()

Returns the tags set for this step.

Returns:

A (sorted) list of tags

Return type:

list[str]

GetTestManagementId()

Returns the test management id of the test step.

Returns:

Test step id.

Return type:

str

GetTestStepId()

Returns the test step id.

Returns:

test step id

Return type:

str

GetTranslatedCommentText(language)

Returns the text value of the “comment” column in the given language.

Parameters:
language : str

Language of the requested text (‘en_US’, ‘de_DE’, ‘zh_CN’)

Returns:

Comment column text

Return type:

str

GetType()

Returns the type (class name) of the test step, e.g.

  • “TsPreconditionBlock”

  • “TsWait”

  • “TsIfThenElse”

  • “TsSwitchCase”

  • “TsCaseNode”

Returns:

Type (class name) of the test step

Return type:

str

GetValueColumnText()

Returns the text value of the “value” column in your current test case language.

Returns:

Value column text

Return type:

str

IsBreakpoint()

Checks whether the test step is a break point.

Returns:

True if test step is a break point, else False

Return type:

boolean

IsContainer()

Returns True, if the test step supports calling GetChildren as well as manipulating the structure of its children. (e. g. via inserting or deleting sub test steps).

Returns:

True if it can contain test steps, else False

Return type:

boolean

IsEnabled()

Returns the state of the test step.

Returns:

True if test step is enabled, otherwise False

Return type:

bool

IsInPostcondition()

Returns True if the test step is located in a postcondition

Returns:

True if the test step is located in a postcondition, else Flase

Return type:

bool

IsInPrecondition()

Returns True if the test step is located in a precondition

Returns:

True if the test step is located in a precondition, else False

Return type:

bool

IsOk()

Returns the internal state of correctness of the test step.

Returns:

True if no problems were found, else False

Return type:

boolean

IsReportingDisabled()

Returns whether reporting of this test step is disabled.

Returns:

True if reporting is disabled

Return type:

boolean

IsVisible()

Checks whether the test step is visible. This depends on the test step itself or a parent test step being disabled.

Returns:

True if test step is visible, else False

Return type:

boolean

RemoveTag(tag)

Remove a specific tag from this step.

Parameters:
tag : str

The tag to be removed

SetBreakpoint(enable)

Sets or unsets the test step to act as a break point.

Parameters:
enable : boolean

True if test step is a break point, else False

SetComment(comment)

Sets a comment for the test step in the current test case language.

Parameters:
comment : str

Text to be displayed in the comment tab

SetEnabled(state=True)

Enable or disable the test step.

Parameters:
state : bool

True (Default) to enable, False to disable the test step.

SetMappingTarget(name, target)

Sets the target path of the mapping. There is no check whether a mapping of the given name exists within the called package. If a check is required, the called package can be examined separately using the PackageApi.

Parameters:
name : str

Name of the mapping in the called package.

target : str

Target path of the mapping or None

Raises:

ApiError – If an empty targetname or None was given

SetPackageParameter(paramName, paramValue)

Assigns a value to a package parameter.

Parameters:
paramName : string

Name of the parameter

paramValue : string

Value to assign to the parameter (can be an expression)

SetPackageParameters(paramDict)

Assigns values to package parameters.

Parameters:
paramDict : dict[str, str]

Dictionary of parameter name -> parameter value (expression) mappings

SetPackageReturn(varInternal, varExternal)

Assigns a package return value to a variable.

Parameters:
varInternal : string

Return variable of the called package

varExternal : string

Variable of the calling package to assign the return value to

SetPackageReturns(returnDict)

Assigns package return values to variables.

Parameters:
returnDict : dict[str, str]

Dictionary of return variable -> variable of the calling package mappings

SetPath(path, packageLibraryAlias=None, libraryNamespace=None)

Sets the path of the referenced package in a package call test step.

Parameters:
path : string

Relative path of the package to be called.

packageLibraryAlias : string

The parameter must be set to None. It is deprecated

libraryNamespace : string

Namespace of a library workspace (requires feature flag)

SetTags(tags)

Set the list of tags for this step. The list of tags will be sorted and stored.

Parameters:
tags : list[str]

The list of tags

SetTestManagementId(testManagementId)

Sets the test management id of the test step.

Parameters:
testManagementId : str

Test management id of the test step

SetTranslatedCommentText(comment, language)

Sets a comment for the test step in the given language.

Parameters:
comment : str

Text to be displayed

language : str

Language of the text (‘en_US’, ‘de_DE’, ‘zh_CN’)

UnsetPackageReturn(varInternal)

Removes a assignment of a package return value to a variable.

Parameters:
varInternal : string

Return variable of the called package