With TestComplete you can create keyword tests in one of the following ways:
You can create a keyword test when creating a new project.
You can add a new keyword test to an existing project.
You can add an existing keyword test to your project.
You can record a keyword test like you record script code or low-level procedure.
In order for you to be able to add keyword tests to your project, the project must contain the Keyword Testing project item (this item is shown in the Project Explorer as a KeywordTests node).
The easiest way to create a keyword test is to record it. To start recording, you can do any of the following:
Select Record Keyword Test from the TestComplete Test Engine toolbar.
Choose Test > Record > Record Keyword Test from the TestComplete main menu.
Click Record New Test on the Keyword Test editor toolbar.
In an empty keyword test, click Record test steps
When recording a script, click Test Type > Keyword Test on the Recording toolbar. In this case, the recorded script will include the commands that will run the recorded keyword test. That is, the keyword test becomes a part of a bigger test (script routine).
You can also add operations to an existing test by clicking Append to Test on the Keyword Test editor toolbar. If the Specify the position to append the operation to option is enabled (default), TestComplete will ask you where to append the recorded operation. Click To End to add the recorded operations to the end of your keyword test. Click To Current Position to add the recorded operations to the keyword test after the selected operation. If you click this button and no operation is selected in the Keyword Test editor, the recorded operations will be added to the end of your keyword test.
After starting the recording, you can perform the desired actions on the application under test.
During the recording TestComplete displays the Recording toolbar where you can pause or stop recording, or command TestComplete to record other tests (scripts or low-level procedures).
To stop recording, click Stop on the Recording toolbar.
You can create a keyword test in the same manner as you create other project elements:
Right-click the KeywordTests node in the Project Explorer panel and choose Add | New Item from the context menu.
In the subsequent Create Project Item dialog specify the name of the test and the name of the file that will store it. Then, click OK.
TestComplete will create the test with the specified name and location and show it as a child node of the KeywordTests node in the Project Explorer panel. Note that the created test is empty. Therefore, you will have to add operations to it in the Keyword Test editor.
To add an existing keyword test to your project:
Right-click the KeywordTests node in the Project Explorer panel and choose Add | Existing Item from the context menu. This will invoke the standard Open File dialog.
In the dialog, choose the file of the desired test and click Open.
TestComplete will add the test file reference to your project and will display the test in the Project Explorer panel as a child of the KeywordTests node. You can then modify the test in the Keyword Test editor.