Relevant for: API testing only
This task describes the workflow and methodology to follow when you create and build a test.
Before creating a test, you need to analyze your application and determine your testing needs. You need to:
|Determine the functionality you want to test.||To do this, you consider the various activities that the application performs. What business processes run? What activities are most relevant for the business processes that you want to test?|
|Identify any processes that run repeatedly.||
Plan to create actions in your test for such processes.
As you plan, try to keep the number of steps that you plan to include in each action to a minimum. Creating small, modular actions helps make your tests easier to read, follow, and maintain.
This can include:
Setting up your global testing preferences.
For details, see Global Options.
Setting up test-specific preferences, including global properties, test input and output properties and parameters, or user profiles and variables.
For details, see Define API test properties or user/system variables.
- Configuring your run session preferences.
For details, see Run Sessions Pane (Options Dialog Box > General Tab).
Import or build the set of resources to be used by your tests, including:
Importing WSDL or WADL files, which define the methods used for a Web service or Web application.
Creating REST service resources and methods if your application is based upon REST services.
For details, see Create a REST service model.
Importing .NET assemblies referenced by your test.
For details, see Import and create a .NET Assembly API test step.
Adding any additional reference files that will be referenced by your test.
For details, see Add Reference Dialog Box.
Note: Skip this step when you will be using only the built-in operations. These activities are available in the Toolbox pane under the Standard Activities section.
Note: API tests cannot be created in a path containing an "equal sign" ('=') character.
To build your basic test structure, do the following:
|Create additional test flow steps- optional||
Expand the Toolbox pane nodes and drag Flow Control activities onto the canvas:
|Add activities to the test to create test steps||
Expand the nodes of the Toolbox pane and drag activities into the Text Flow or a Loop box within the canvas to create test steps. If you added a Condition step, drag activities into the condition branches.
Provide the step properties
Enter the input, output, and checkpoint properties (as needed) for each activity. For details on the input, output, and checkpoint properties available for each activity, see Standard Activities.
If you have a number of activities/steps that are repeated often in your test, consider creating an action and adding the steps to this action. After creating the action, you can call the action each time you need to repeat these steps in your test instead of adding the activities and setting the activity's properties repeatedly.
To enhance your test steps, do any of the following:
|Define data sources for the test||
For details, see Assign data to API test/component steps.
|Create a Custom Code activity||
|Add an event handler - optional||
For any activities, you can define default event handlers for checkpoints, and before and after step executions.
ConcatenateStringsActivity cat = args.Activity as ConcatenateStringsActivity; args.Checkpoint.Assert.Equals(cat.Prefix+cat.Suffix, cat.Result);
After you create your test, you can perform different types of runs to achieve different goals. You can:
|Run your test to check your application.||
The test starts running from the Start step in the canvas and stops at the end of the test. While running, UFT performs each step in your test, including any checkpoints.
If you parameterized the test using data from a data source stored in the Data pane, UFT repeats the test (or test flow loop, if needed) using the data as defined in the Input tab for the Test Flow or test flow steps.
|Run your test to debug it.||
Before running a debugging session, make sure to enable debugging capabilities by selecting the Run test in debugging mode option in the General Pane.
|Run an individual step.||
Select the step in the canvas and choose Run Step from the context menu to run the step with its property values. Note the results in the Run Step Results pane, in the lower section of the main window. If something needs to be modified, do so at this point.