Run an API test with standard activities
This exercise describes how to create and run an API test with standard activities that write a string to a new text file.
Create a new test
Create a new test for this exercise:
-
In OpenText Functional Testing, click New toolbar button down arrow and select New Test.
-
In the New Test dialog box:
- Select API Test.
- In the Name field, enter Standard.
- Leave the default location, and leave the Solution Name field blank.
- Click Create to create your new test.
The test is shown in the Solution Explorer, under the Solution Untitled node, which is the default name when no solution is specified.
The empty test flow is also shown in the Document pane, in the Standard tab.
Add steps to your test and define their properties
Add steps to your test to replace a string, create a text file, and then write the results of the string replacement to the new file.
To add the steps to your test:
-
From the Toolbox pane, drag the following activities to the Test Flow, in this order:
- String Manipulation > Replace String
- File > File Create
- File > Write to File
-
Define properties for the Replace String step.
Select the Replace String step in the canvas, then define the properties on the right.
In the Input/Checkpoint tab of the Properties pane, enter the following values:
Source string Hello world. Search string Hello Replace string Goodbye Note: No checkpoints are required for this step.
-
Define properties for the File Create step.
Select the File Create step in the canvas. Then, define the properties on the Input/Checkpoint tab as follows:
Input area Define the Folder path value:
- Hover in the Value cell, and click the Browse for folder... button.
- Browse to C:%HOMEPATH%\My Documents\UFT One, and create a new folder named Tutorial_Files.
- Click OK to select the Tutorial_Files folder as the value for the Folder path.
File name. Enter Standard Test Result.
Overwrite. Select true.
Checkpoints area Select the Result Validate checkbox.
Leave the default value (= true).
-
Define properties for the Write to File step.
Select the Write to File step in the canvas. Then, define the properties on the Input/Checkpoint tab as follows:
Input area Enter the following values:
- Content. Enter Goodbye world.
- File path. Enter C:%HOMEPATH%\My Documents\UFT One\Tutorial_Files\Standard Test Result
Leave all the other default values.
Checkpoints area Select the Result Validate checkbox.
Leave the default value (= true).
- Save your test, and then continue with Run the test and view run results.
Run the test and view run results
Run your test to see how OpenText Functional Testing creates the file and writes the string to it, as configured.
To run the test:
- In the toolbar, click the Run button .
-
In the Run dialog, ensure that the Standard test is selected. Accept the other default values, and click Run to start running the test.
-
When the test run is complete and the run results are displayed, open the C:%HOMEPATH%\My Documents\UFT One\Tutorial_Files\Standard Test Result from the Windows Explorer.
You'll see the string Goodbye world. in the first line of the file, because OpenText Functional Testing ran those steps using standard API activities provided by OpenText Functional Testing.
Next steps: