API for Workspaces

Part of the Object based program API.

class WorkspaceApi

API to access the workspace

Returned by

GetReferencesIn(filePath)

Checks the passed file whether it contains references and returns the contained references as a list of absolute file paths.

Parameters:
filePath : str

References in this package/project are searched for.

Returns:

The absolute paths of all references to packages/projects within filePath. If no references are found, an empty list is returned.

Return type:

list[str]

GetReferencesTo(filePath)

Traverses the workspace and searches in all packages and projects for references to the passed package/project and returns the references as a list of absolute file paths.

Parameters:
filePath : str

References to this package/project path are searched for.

Returns:

The absolute paths of all packages/projects referencing to filePath. If no references are found, an empty list is returned.

Return type:

list[str]

SearchFiles(searchCriteria, useExtendedMode=False)

Searches the current workspace and library workspaces for files matching the given search criteria.

Parameters:
searchCriteria : str

The search criteria expressed in the ecu.test filter syntax. See section “Handling” => “Filter” of the ecu.test User Documentation.

useExtendedMode : boolean

If True, extended search strings are enabled. The default is False, meaning each word in the searchCriteria will be enclosed by wildcards and mapped to the filename. (e.g. “hello world” => “Name = ‘*hello*’ and Name = ‘*world*’”)

Returns:

The absolute paths of all matching files in the workspace. If no file matches, an empty list is returned.

Return type:

list[str]

Raises:

ApiError – If the searchCriteria has an illegal syntax.