Library workspaces

With library workspaces, content of a workspace can be reused in other workspaces. Changes in the library automatically affect all referencing workspaces. Library artifacts will also be found via EasyInsert and inserted directly.

The integration of such a library into another workspace is done by specifying a path in the ecu.test settings.

ecu.test ships with an example workspace as part of Tutorial library workspace which can be used to follow along with all the steps required to configure and use a library workspace.

Creation

To declare a workspace as a library workspace, the following settings must be made:

  1. Open the dialog Options ‣ Settings ‣ Workspace-Settings.

  2. Configure the Title and Version.

  3. Enable the checkbox Is a library

  4. Enter a unique name for the library in the Namespace field.

../_images/configureWorkspaceSettings.png

Warning

Changes to the namespace lead to incorrect references. The namespace of a library workspace has to be unique! This is necessary to avoid ambiguity when using multiple library workspaces.

Info

A library workspace can have dependencies to other library workspaces. It is mandatory however for those transitive dependencies to be added to the libraries of the main workspace. Otherwise errors caused by their absence will not be detected until test runtime. In addition, the order is also important. Transitive dependencies must be inserted before the other dependencies.

Declaring a workspace as a library workspace results in some changes in ecu.test. These changes are described in Contents of library workspaces in more detail.

Usage

A workspace can reference any number of library workspaces. It is integrated by specifying the path to the respective library workspace in the ecu.test settings.

Under the category Libraries in the ecu.test settings under Workspace settings ‣ Libraries the library workspaces are managed. Library workspaces can be added, removed or edited using the img_add, img_remove and img_edit buttons.

../_images/configureLibraries.png

Contents

The following elements can be outsourced to libraries for centralized maintenance and reuse. This also includes Templates for projects, packages and analysis packages. To quickly distinguish between artifacts from libraries and those from the main workspace, petrol-colored icons are used for artifacts from libraries.

Element

Standard icon

Library icon

Package and Package template

package_icon

lib_package_icon

Analysis package and Analysis package template

analysis_package_icon

lib_analysis_package_icon

Project and Project template

project_icon

lib_project_icon

Test configurations

testConfiguration_icon

lib_testConfiguration_icon

Test bench configurations

testBenchConfiguration_icon

lib_testBenchConfiguration_icon

Project generator

prjgen_icon

lib_prjgen_icon

Package generator

pkggen_icon

lib_pkggen_icon

Parameter generator

pargen_icon

lib_pargen_icon

Global mapping

mappingfile_icon

lib_mappingfile_icon

Constants definition

globalconstantsfile_icon

lib_globalconstantsfile_icon

Trace step templates

no icon

no icon

User Python library

no icon

no icon

Report generator

no icon

no icon

User-defined utility

no icon

no icon

User-defined Tools

no icon

no icon

If elements from a library workspace are added to a package or project in the main workspace via drag & drop from the workspace explorer or via the context menu, a library reference is always created.

Package

Packages from a library workspace are added to a package via drag & drop from the workspace explorer. This creates a library reference. Further information on the different types of package references can be found in the section Package references.

../_images/libPackageCall.png

A package in a library workspace can also call another package from the same library workspace. In this case, the package is always integrated with a library reference.

Info

It is also possible to integrate main workspace packages into library packages. In contrast to the other cases, an absolute package reference is always generated. This backward dependency has a negative impact on the reusability of the library due to the absolute path references!

Project

A project in a library workspace can call up packages and projects from the same library workspace as well as from other, transient library workspaces.

Configurations

Test configurations (TCF) as well as Test bench configurations (TBC) can be outsourced to library workspaces to ensure centralized maintenance and reusability. They can also be managed in different libraries.

Creation

Configurations can be created and edited either directly within the respective library or from a local workspace and saved into a referenced library.

If a configuration contains references to artifacts, the following restrictions apply:

  • Relatively specified file references, e.g. to bus databases or A2L/HEX files, always refer to the library workspace in which the configuration is stored. Relatively referenced files must therefore be stored in the same library workspace.

  • Alternatively, an absolute path can always be specified.

Important

A base path <workspace> in the TBC causes the library workspace in which the TBC is stored to be used as the base path. The base path is used for the configuration of some tools and makes it possible to use relative paths in the tool configuration.

Usage

Configurations from libraries can be dragged and dropped into the configuration area or the project in the same way as those from the main workspace. In the latter case, a configuration change configChange_icon is inserted in the project. As soon as a configuration change contains at least one reference to a library, it is marked with a petrol-colored icon lib_configChange_icon.

Migration assistance for moving to a library workspace

Under certain circumstances, test configurations and test bench configurations may need to be adjusted after moving them from the main workspace to a library workspace to ensure that references to artifacts such as constant definition files and global mapping files do not become invalid.

The following procedure is recommended for migrating configurations:

  1. Move configurations

    Move configuration files (TCF + TBC) to the library workspace.

  2. Migrate relatively referenced artifacts

    All artifacts that were specified relatively in the moved configurations (e.g. model files, bus databases, .a2l, .hex) must also be moved to the library workspace. If the folder structure is not transferred exactly, the relative paths in the configuration must be adjusted.

  3. Check absolutely referenced artifacts

    Absolute paths usually do not require any adjustments. However, for consistency reasons, it is recommended to check whether these artifacts can also be moved to the library workspace.

  4. Convert references to library references

    • Start ecu.test in library workspace.

    • Remove the entries for global mapping files (.xam) in the General tab of the test configuration and select the artifacts migrated to the library workspace.

    • Remove the entries for constant definition files (.gcd) and constant definition scripts (.py) in the Global Constants tab of the test configuration and select the artifacts migrated to the library workspace.

    Info

    ecu.test automatically creates a library reference in the form <libraries.libNamespace.parameters>\file.

  5. Verification in the library workspace

    Select and start the migrated configurations. No messages about missing files should appear and the configurations should start successfully.

  6. Verification in the main workspace

    • Start ecu.test in the main workspace.

    • Select and start the migrated configurations from the library workspace. No messages about missing files should appear and the configurations should start successfully.

Trace step template

Trace step templates from a library workspace are added to a package via drag & drop from the tab Trace step templates. A library reference is always created.

The call is defined by a path expression. The syntax of such an expression can be seen when double clicking the added trace step. It consists of the following elements:

libraries.<namespace of library>.traceStepTemplates + <relative trace step template path in the library workspace>

Example: libraries.exampleLibWorkspace.traceStepTemplate + 'MyLibTemplate.trcp'

../_images/libTraceStepTemplate.png

Generators

Project generators of a library workspace can also be used by projects in the main workspace. By using the context menu of the function prjgen_icon Project generator, the project generator of the library workspace can be created and integrated into the selected workspace project. Every call of a project generator is referenced by a unique ID.

When calling a project generator from the library workspace, the namespace of the library workspace is prefixed to the name of the project generator for better differentiation.

Example: exampleLibWorkspace: CallOwnLibPackages

../_images/libProjektGenerator.png

Similar to the project generators, package generators and parameter generators of a library workspace can also be integrated.

Templates

The Templates can be managed in a library workspace. They are then available for selection in the main workspace when creating a new artifact.

Report generators

Report generators from library workspaces are also available in the report tab of test configurations and can be selected there. They are also shown in the Report Viewer and can be selected for report generation.

An overview of commands that can be used in own report generators can be found in the Report API.

Info

If multiple report generators with the same name are found, the following priority applies:

  1. Workspace

  2. Library workspaces (last entry of Libraries has highest priority)

  3. Templates directory of ecu.test installation directory

User Python library

If User Python libraries are stored in a library workspace they can also be called in packages of the main workspace.

To do so, the path to the User Python librariy function must be entered into the Expression field of a Calculation test step.

Example: libraries.exampleLibWorkspace.user.return42Module.return42()

The module libraries.<NAMESPACE>.user must always be used as a prefix in the call.

../_images/libUserPyModule.png

Info

To avoid naming conflicts, the user module is not available in library workspaces.

Important

So instead of the normal call,

from user.MyModule import UserClass

the calls should be

from libraries.exampleLibWorkspace.user.MyModule import UserClass

where exampleLibWorkspace is the namespace of the library workspace to import from.

Of course, it is possible to move the existing user-defined customizations of ecu.test, which were stored in the user Python library into a library. Examples are own package checks, customization of test management connection or also user defined image filters.