Adding and Removing Project Items and Their Child Elements

Applies to TestComplete 14.70, last modified on April 22, 2021

You use project items of your TestComplete project to perform various tasks. For example, you use the KeywordTests project item to manage your keyword tests. You can add project items to your projects and delete them from there.

Note: Depending on the project item type, you can have only one instance of it in your project or multiple instances. For example, a project can have a single Script project item and several Selenium and Unit Testing items.

To add a new item to a project

  1. To add a new project item to a project, in the Project Explorer, right-click the project and then click Add > New Item.

    To add a new child item to a project item, right-click the project item in the Project Explorer and then click Add > New Item.

    To add a new keyword test or script unit, you can also click next to the appropriate project item in the Project Explorer.

  2. TestComplete will show the Create Project Item dialog.

  3. In the dialog, select the item type (if several types are available) and enter the item name.

  4. Specify other item properties, if available.

  5. Click OK.

Properties you can specify in the dialog depend on the type of the item you are adding. However, all project items in TestComplete projects have the following properties:

  • Name - Used to name the file storing the project item data and to address the item from tests. It must be a valid file name and a valid script identifier. Scripting languages that TestComplete supports use different naming rules. The easiest way to make the name suitable for any language is to use only alphanumeric and underscore characters in the name and to start the name with a letter.

    This rule does not apply to project items that are not called in scripts by their names (for example, it does not apply to feature files under the Scenarios project item).

    Some project items have predefined names that cannot be changed.

  • Location - Specifies the folder to which the project item file will be stored.

You can also add existing project items (for example, from another TestComplete project) to your current project (see below).

Note: When you add a project item, it is immediately saved on the disk. If you try to create an item with the same name, the The item_name cannot be created message will appear. To resolve the issue, you can load the existing item as described below.

To add an existing project item from a file

  1. To add an existing project item to a project, in the Project Explorer, right-click the project and then click Add > Existing Item.

    To add an existing child item to a project item, right-click the project item in the Project Explorer and then click Add > Existing Item.

  2. In the resulting Open File dialog, browse for the item file.

Adding an existing item from a file does not create a copy of this item. TestComplete adds a reference to the item. If the added item does not reside in your current project’s folder, it is marked with the icon in the Project Explorer. This indicates that the item is potentially shared among several projects. Deleting this item may affect all projects that share the item.

Notes:

  • TestComplete does not support sharing container items, that is, the items that can have child elements. For example, you can share individual keyword tests, but not the KeywordTests project item.

  • You cannot share child elements of the Stores project item within the same project suite.

  • If you add a keyword test or a script unit which is used in another project and have Test Visualizer images associated with test commands, these images will not be included in the project. That is, Visualizer frames are not shared. See also Sharing Project Items.

To organize items into folders

You can organize project items and their child elements into logical folders in the Project Explorer panel. These folders contain child elements of the node, to which the folder belongs (see Organizing Items Into Folders).

You can add items to the folders the same way you add them to the project items, that is, by using the Add > New Item and Add > Existing Item items of the Project Explorer’s context menu.

To delete a project item from its project

  1. Right-click the desired project item in the Project Explorer panel and choose Remove from the context menu.

    Once you do this, you will be asked whether you want to remove the project item and its children from the project (but keep the corresponding files), or whether you want to completely delete the item’s files from the disk.

  2. Select the action you want by pressing the Remove or Delete button.

Similarly, you can delete child elements of project items: right-click the desired project item in the Project Explorer panel and then choose Remove from the context menu.

See Also

Managing Projects, Project Suites and Project Items
Organizing Items Into Folders

Highlight search results