Adding and Removing Project Items and Their Child Elements

Applies to TestComplete 15.69, last modified on November 13, 2024

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 a project item from another project or from an external file

  1. In the Project Explorer, right-click the project or a project item and then click Add > Existing Item.

  2. In the resulting Open File dialog, browse for the file that stores the item you want to add. To learn about file types used by TestComplete projects, see Project and Project Suite Files.

TestComplete will not create a copy of the added item but add a reference to it. If the added item resides outside of the current project’s folder, it will be marked with the icon in the Project Explorer. If you add an item that belongs to another project, it will be shared among the projects. Editing or deleting this item will 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 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