Test management API¶
Info
The interface is included in the ecu.test Interface Python Library
ecutest-interface.
AbstractTmUserAdapter¶
- class AbstractTmUserAdapter¶
Base class for all user test management adapter. This interface offers the possibility to implement your own adapter as a connection to a test management system.
- Attention:
In order for ecu.test to recognize a class as a user test management adapter, the class must meet the requirements of this interface. You must define MODULE_TYPE at module level in your implementation Python file.
from tts.interface.testManagement import AbstractTmUserAdapter MODULE_TYPE = AbstractTmUserAdapter.MODULE_TYPE class MyTmsAdapter(AbstractTmUserAdapter): ...- abstractmethod __init__(properties)¶
- Parameters:
- properties : dict[str, int | str | float | bool | None]¶
Contains the configured properties for the concrete adapter as a dictionary. Key: The name of the property. Value: The value for the property.
- abstractmethod classmethod GetName()¶
- Returns:
The name of the user test management adapter. This name is displayed in the test management configuration.
- Return type:
str
- classmethod GetAvailableProperties()¶
Optional (does not have to be implemented)
Defines the properties available for the user test management adapter as dictionary. Each property is identified by its name and described within its own dict containing information on ‘Description’, ‘Type’ and ‘Default’. Note that this method defines the properties that are generally available within ecu.test’s settings. The values that have been set by the user for each property will be available at runtime through the properties dictionary passed to the __init__() method.
Example:
@classmethod def GetAvailableProperties(cls) -> dict[str, dict]: return { 'Option 1': { 'Description': 'This is Option 1', 'Type': 'STRING', 'Default': 'default value', }, 'Option 2 (bool)': { 'Description': 'This is Option 2 (bool)', 'Type': 'BOOL', 'Default': False, }, 'Option 3': { 'Description': 'This is int Option 3', 'Type': 'INTEGER', 'Default': 42, }, 'Option 4': { 'Description': 'This is float Option 4', 'Type': 'FLOAT', 'Default': 9.99999, }, }- Returns:
Dictionary with properties of the user test management adapter.
- Return type:
dict[str, dict]
- abstractmethod Login()¶
Log in to the test management system.
- Returns:
True if login was successful, False otherwise.
- Return type:
bool
- abstractmethod Logout()¶
Log out of the test management system.
- Returns:
True if logout was successful, False otherwise.
- Return type:
bool
- abstractmethod IsLoggedIn()¶
Returns if there is currently an active user logged in. Depending on that information, Login() may be called for the current user action.
- Returns:
True if the active user is logged in, False otherwise.
- Return type:
bool
- ExportProject(filePaths)¶
Optional (does not have to be implemented)
Exports PRJ files to the test management system.
Info
To ensure the test runs of the project can be linked to the exported test suite within the test management system, it is usually necessary to set the matching test suite ID within the original PRJ file, see also ObjectApi.ProjectApi.Project.SetTestSuiteId().
- Parameters:
- filePaths : list[str]¶
The file paths (.prj) of the projects that should be exported.
- ImportProject(targetDirectory, tmsIds)¶
Optional (does not have to be implemented)
Imports projects from test management system and saves it as PRJ files. This method needs to contain: - the selection of the project within the test management system - the generation of the PRJ file using the ObjectApi.ProjectApi.
Info
To ensure the test runs of the specific project can be linked to the original test suite within the test management system, it is usually necessary to set a test suite ID for the PRJ file, see also ObjectApi.ProjectApi.Project.SetTestSuiteId().
- ExportPackage(filePaths)¶
Optional (does not have to be implemented)
Exports PKG files to the test management system.
Info
To ensure the test runs of the package can be linked to the original test script within the test management system, it is usually necessary to set the correct test management ID for the PKG file after export to the test management system, see ObjectApi.PackageApi.Package.SetTestScriptId().
- Parameters:
- filePaths : list[str]¶
Paths of the package files (.pkg) to be exported.
- ExportPackageChanges(filePaths)¶
Optional (does not have to be implemented)
Exports PKG file changes to the test management system.
- Parameters:
- filePaths : list[str]¶
Paths of the package files (.pkg) to be exported.
- ImportPackage(targetDirectory, tmsIds)¶
Optional (does not have to be implemented)
Imports packages from the test management system and saves it as PKG files. This method needs to contain: - the selection of the package within the test management system - the generation of the PKG file using the ObjectApi.PackageApi.
Info
To ensure the test runs of the package can be linked to the original test script within the test management system, it is usually necessary to set a test management ID for the PKG file, see also ObjectApi.PackageApi.Package.SetTestScriptId().
- classmethod GetCustomPackageActions()¶
Optional (does not have to be implemented)
Allows to define custom actions for Packages. These will be added to the “Test management” context menu if one or more Packages are selected. Please note that every action’s callback method must be able to handle a list of file paths, in case multiple Packages were selected.
Example:
@classmethod def GetCustomPackageActions(cls) -> dict[str, Callable[[list[str]], None]]: return { "My custom package action": cls.MyPackageAction } def MyPackageAction(self, packagePaths: list[str]) -> None: for pkgPath in packagePaths: print(f"Processing package {pkgPath}")- Returns:
A dictionary that maps action labels to their callback.
- Return type:
dict[str, Callable[[list[str]], None]]
- classmethod GetCustomProjectActions()¶
Optional (does not have to be implemented)
Allows to define custom actions for Projects. These will be added to the “Test management” context menu if one or more Projects are selected. Please note that every action’s callback method must be able to handle a list of file paths, in case multiple Projects were selected.
Example:
@classmethod def GetCustomProjectActions(cls) -> dict[str, Callable[[list[str]], None]]: return { "My custom project action": cls.MyProjectAction } def MyProjectAction(self, projectPaths: list[str]) -> None: for prjPath in projectPaths: print(f"Processing project {prjPath}")- Returns:
A dictionary that maps action labels to their callback.
- Return type:
dict[str, Callable[[list[str]], None]]
- classmethod GetCustomDirectoryActions()¶
Optional (does not have to be implemented)
Allows to define custom actions for directories. These will be added to the “Test management” context menu if one or more directories are selected. Please note that every action’s callback method must be able to handle a list of file paths, in case multiple directories were selected.
Example:
@classmethod def GetCustomDirectoryActions(cls) -> dict[str, Callable[[list[str]], None]]: return { "My custom directory action": cls.MyDirectoryAction } def MyDirectoryAction(self, directoryPaths: list[str]) -> None: for dirPath in directoryPaths: print(f"Processing directory {dirPath}")- Returns:
A dictionary that maps action labels to their callback.
- Return type:
dict[str, Callable[[list[str]], None]]
- UpdateAttributeDefinitions()¶
Optional (does not have to be implemented)
Queries all available attributes from the test management system for use in packages and projects.
- FetchChildrenForPackageImport(tmsId)¶
Optional (does not have to be implemented)
Returns the direct children (only first level) for the test management object with the specified tms id. If the tms id is empty the top-level objects are returned. The result will be displayed in the dialog to import packages. For the chosen packages ImportPackage() will be called.
- Parameters:
- tmsId : str¶
Tms id of the parent object.
- Returns:
List with available children.
- Return type:
list[TmObjectInfo]
- FetchChildrenForProjectImport(tmsId)¶
Optional (does not have to be implemented)
Returns the direct children (only first level) for the test management object with the specified tms id. If the tms id is empty the top-level objects are returned. The result will be displayed in the dialog to import projects. For the chosen projects ImportProject() will be called.
- Parameters:
- tmsId : str¶
Tms id of the parent object.
- Returns:
List with available children.
- Return type:
list[TmObjectInfo]
TmObjectInfo¶
- class TmObjectInfo¶
Contains information about an object from the test management system.
- Variables:
- name : str
Name of the object inside the test management system.
- tmsId : str
Identifier inside the test management system.
- attributes : dict[str, str]
Additional information about the object. E.g. author, date etc.
- __init__(name, tmsId, attributes=<factory>)¶