Use TC-Shell commands

Standard commands

TC-Shell – Default Commands

help or ?

Provides the list of possible commands.

exit

Close the current TC-Shell session. This is only relevant for the interactive mode. If you have unsaved modifications, Tosca Commander ask whether to save or discard the changes.

save

Save all modifications.

saveAndUnloadAll

Save all modifications that were made up to this time and release used memory.

adminModusOn

Enable administrator mode.

adminModusOff

Disable administrator mode.

print

Display all known information about the current object (attributes and objects in direct relation).

set

set <attributeName> = <Value>

Set the specified value for the attribute in the current object if the attribute can be modified (i.e. the attribute is not read-only).

The symbol = as symbol of assignment is optional.

get

<attributeName>

Get the attribute value of the current object.

getAllOptions

Display all current values within the TC-Shell settable options (see chapter "Starting TC-Shell").

getBranches

Display all branches that are available within the common repository.

getOption

<optionName>

Display the value of the specified option.

setOption

<optionName> ["="] <optionValue>

Set the specified value for the specified option. This change applies only to the current session.

The symbol = as symbol of assignment is optional.

saveOptions

Save option values for permanent use, i.e. not only for the current session.

setproperty

SetProperty <PropertyName> ["="] <Value>

Create an individual customized property for the current object. If a property with same name exists already, the system only transfers the value.

The symbol = as symbol of assignment is optional.

settcparam

settcparam <Name of test configuration param> = <Value>

Create a test configuration parameter for the current object with the specified value.

The symbol = as symbol of assignment is optional.

compactworkspace

Deallocate unused storage in the local repository of a workspace and, by this, improve the performance.

You can only observe improvements in performance in case of extensive database files in the workspace.

createdbbackup

createdbbackup "no" <backup directory>

Create a backup of the repository in the specified directory. Use double backslash \\ symbols as separators between the components in the file path, e.g. C:\\Tricentis\\backup\\backup_repository.

In script mode, add yes or no after <backup directory> depending on whether you want to include versioning history in the backup.

In interactive mode, decide whether to include versioning history in the backup in the subsequent dialog.

backupFolder

backupFolder "no" <path to the backup directory>

This command only works if the current object is the ComponentFolder.

Create a backup of a ComponentFolder in the specified directory. Use double backslash \\ symbols as separators between the components in the file path, e.g. C:\\Tricentis\\backup\\backup_folder.

In script mode, add "yes" or "no" before the <path to the backup directory> to decide whether you want Tricentis Tosca to search for external references of the objects within the ComponentFolder. If you add "yes", i.e. initiate an external reference check, add "yes" or "no" as a second parameter to decide whether the backup process should be canceled if there are external references.

  • Example: Check for external references and cancel the backup process if external references are found.

    backupFolder "yes" "yes" "C:\\Tricentis\\backup\\backup_folder"

  • Example: Check for external references and continue the backup process even if external references are found.

    backupFolder "yes" "no" "C:\\Tricentis\\backup\\backup_folder"

  • Example: Don't check for external references.

    backupFolder "no" "C:\\Tricentis\\backup\\backup_folder"

In interactive mode, decide whether you want Tricentis Tosca to search for external references of the objects within the ComponentFolder. If there are external references, in the subsequent dialog, decide whether you want to cancel the backup process. Finally, provide the path to the directory where you want to create the backup in the subsequent dialog.

deleteOldExecutionLogs

deleteOldExecutionLogs

Delete ExecutionLogs from Tricentis File Service that are older than a specified number of days.

In script mode, add a number after the deleteOldExecutionLogs command, separated by a space, to define which ExecutionLogs to delete. Tosca deletes all ExecutionLogs older than the specified number of days. To delete all ExecutionLogs stored on Tricentis File Service, specify -1.

After the number, add True or False to decide whether to delete complete ExecutionLogs, i.e. including attached screenshots, or only the screenshots attached to them. False deletes complete ExecutionLogs for the specified period, while True only deletes screenshots attached to the ExecutionLogs.

  • Example: Delete all ExecutionLogs from Tricentis File Service that are older than 60 days.

    deleteOldExecutionLogs 60 False

  • Example: Delete only screenshots attached to all ExecutionLogs from Tricentis File Service that are older than 100 days.

    deleteOldExecutionLogs 100 True

  • Example: Delete all ExecutionLogs from Tricentis File Service.

    deleteOldExecutionLogs -1 False

In interactive mode, specify a number of days to define which ExecutionLogs to delete in the subsequent dialog. Tosca deletes all ExecutionLogs older than the specified number of days. To delete all ExecutionLogs stored on Tricentis File Service, add -1 after the command.

In the subsequent dialog, decide whether to delete complete ExecutionLogs or only screenshots attached to the ExecutionLogs:

  • False deletes complete ExecutionLogs.

  • True deletes only screenshots attached to the ExecutionLogs.

Use modify commands

You can modify the values of TC-Shell object properties via modify commands. Modify commands are available in the context menu of Tosca Commander. You can also use regular expressions (UseRegularExpression).

Modify Name

Description

Modify the object name.

Example

[23]='Modify Name'

[24]='Modify Description'

[25]='Modify SynchronizationPolicy'

[26]='Export Subset'

Select Task to execute by number # [1-26,0=none] or by name > 23

Use Regular Expression (yes/no) > n

Replace with: > <new name>

TCFolder:test > <new name>

Modify Description

Description

Modify the object description.

Example

Use Regular Expression (yes/no)> y

Search for:> <name>

Replace with:> <new name>

Use commands related to current object

In the TC-Shell there is always a current object. If you open a workspace or delete an object, the project object automatically becomes the current object.

Use the following commands to jump to other objects:

TC-Shell commands for navigating between objects

JumpToProject

The project object becomes the new current object.

JumpToNode <NodePath>

Each object has a NodePath which contains the object name and hierarchical position.

Use this command to jump to the object specified by the given NodePath.

Example:

>JumpToNode "/TestCaseFolder/SampleTestCases/

Automated TestCases"

This selects a folder and converts it into the next current object.

JumpTo<uniqueQueryString>

<uniqueQueryString> is an arbitrary TQL query string which returns exactly one object.

Use the following commands to search for a TestCase of a specific name, starting from the project:

"=>Items:TestCase[Name==\"TC1\"]"

or to switch from a TestStepValue to the parent TestStep:

"->Test Step"

If you use this command, the search result becomes the new current object.

ChangeNode <NodePath>

or

cn <NodePath>

In contrast to JumpToNode this supports relative paths.

Examples:

> cn "TestCases"

> cn "Folder"

Based on the project root element, > cn "TestCases" turns the "/TestCases" folder into the current object, while > cn "Folder" turns the "/TestCases/Folder" folder into the current object.

In addition, you can use cn to access the superordinate object:

> cn ..

Search <queryString> <resultNum>

Navigate between the returned search results.

<queryString> is a TQL query string.

<resultNum> is the index of the object in the result list. The system jumps to the object specified by the <resultNum> value. Use 0 if you don't want to change the current object.

Mark objects and drag and drop tasks

For certain operations (e.g. drop tasks) you can use any number of objects as arguments, e.g. to move a set of TestCases into another folder. In Tosca Commander, you use drag and drop to perform such actions.

In TC-Shell, use the following commands to mark objects or activate drop tasks:

Mark objects and drop tasks

Mark

Add the current object to the list of the marked objects.

ClearMarked

Clear the list of the marked objects.

DropMarked

Perform the drop task based on the context of the current object and all marked objects, then clear the list of marked objects.

Example:

Create TestSteps based on three existing Modules:

> JumpToNode "/ModuleFolder/T car tariff calculator"

> Mark

> JumpToNode "/ModuleFolder/T vehicle data"

> Mark

> JumpToNode "/ModuleFolder/T person data"

> Mark

> JumpToNode "/TestCaseFolder/Tutorial/Automated TestCases/MyTestCase"

> DropMarked

DropMarkedWithCtrl

Perform the DropMarked action with the Ctrl key pressed (copy==True).

Execute tasks

In Tosca Commander you call and perform actions depending on the environment you are working in. The selected element defines the available options.

In TC-Shell, these context-based operations are called tasks. Use the variables of the task command to perform such actions.

TC-Shell tasks

Command

Description

task

Display a numbered list of all available actions. The names of the actions correspond to the context menu entries in Tosca Commander.

task <taskNum>

Call an action by using its number. Run the task command to view a list of valid numbers.

task <taskName>

Call an action by using its name. Run the task command to view a list of valid names.

Example:

>task "Create TemplateInstance"

According to their flow, tasks require additional entries, (e.g. file or directory paths, the entry of strings, the confirmation of actions, etc.) which you have to provide.

In interactive mode, provide the required information in the prompt (command line). In script mode, indicate the corresponding information in the script file.

Example

Create a TemplateInstance to a TestCaseTemplate:

jumpToNode "/TestCaseFolder/SampleTestCases/Generated

TestCases/CheckCarInsur"

task "Create TemplateInstance"

// *** Input to "Create TemplateInstance"-Task

// DataSourcePath including Sheet =

"C:\\Projects\\ToscaTutorial\\BO_TC\\TC_catalog_web.xls\\TC_RS"

// Instantiation Selector =

"The first 10 hits"

// *** End of Input to "Create TemplateInstance" Task

Call other scripts

In interactive mode and the script mode, you can access script files by using the Call command.

TC-Shell call

Call <scriptPath>

You can specify the path to the script file absolutely or relatively to the requested script.

The current object remains the same current object as at the time of the call.

Iterate objects

Use the following commands to perform operations on a large number of objects:

TC-Shell iteration

For <queryString> CallOnEach <scriptPath>

Call up a script for every object in the result list of the TQL query.

In this case, the respective object becomes the current object for the script call.

For <queryString> MarkAll

Add all objects of the result list to the list of marked objects.

For <queryString> TaskOnEach <taskName>

Call up the task for every object of the result list.

In this case, the respective object becomes the current object for the script call.

For <queryString> TaskOnAll <taskName>

Call up the task once for all objects of the result list. This is possible only for multi-selectable tasks.

Example:

Disable several TestSteps while providing the reason only once.

> For "=>Items:Test Step[Name==\"calculatePremium \"]" TaskOnAll "Disable"

> // Disable-Reason for all

> "Module is going to be reorganized"

Use TC-Shell in multi-user environments

In multi-user environments, you must check out objects before you modify them. To do so, activate the Check out task at the particular object.

To check all modifications into the common repository or to transfer the latest state of the repository into the local workspace, use the following commands:

TC-Shell for multi-user environment

checkinall

Check in all objects that you checked out from the workspace to the common repository.

updateall

Update the local workspace to the current state of the common repository.