Adding and Removing Project Items and Their Child Elements

Applies to TestComplete 14.20, last modified on September 11, 2019

Each project item extends functionality of your test project. You use project items to perform various testing tasks, for instance, you use the Keyword Tests project item to manage your keyword tests.

You can add project items you need to and delete them from your project. The number of project items of the same type that can simultaneously exist in the project depends on the item type. For instance, the project may hold only one Script project item, but several Selenium or Unit Testing project items.

To add a new project item to a project

  1. Right-click the desired project in the Project Explorer panel and choose Add > New Item from the context menu. TestComplete will show the Create Project Item dialog.

  2. In the dialog, select the desired project item, specify its properties and press OK.

The properties to be specified in the Create Project Item dialog depend on the project item type. All project items built-in TestComplete have two properties: Name and Location.

  • The Name property is used to name the file storing the project item’s settings. Therefore, it must be a valid file name.

    The project item name is also often used to address the item in scripts, so it must be a valid script identifier. Different languages supported by TestComplete use different naming rules for scripting objects. The easiest way to make the object 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.

  • The Location property specifies the folder to which the project item file will be stored. This file is in XML format.

You can also add existing project items to the project from the files to which these project items are stored.

Note: When you add a project item, it is immediately saved on the disk. If you do not delete it, the The item_name cannot be created message will appear when you try to create an item with the same name. If this happens, you can load the existing item by following the instructions below.

To add an existing project item from a file

  1. Right-click the project in the Project Explorer panel and choose Add > Existing Item from the context menu.
  2. Using the ensuing Open File dialog, select the file of the desired project item.

Similarly, you can add new or existing child elements to project items: right-click the desired project item in the Project Explorer, select Add > New Item or Add > Existing Item from the context menu and use the ensuing dialogs to create the new child element.

Adding an existing item from a file does not create a copy of this item. TestComplete just adds an item reference to your project.

Notes:

  • If the added item does not reside in the project’s folder, the Project Explorer marks it with the icon. This indicates that the item is potentially shared among several projects. Deleting this item can make the other projects non-functional.

  • 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.

    Note: 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 add items to 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