QTP Training Guide #5 – Moving Steps, Erasing Steps, and Managing Breakpoints in the Keyword view. This is the fourth and final article on QTP Keyword view functionalities.
We are nearing the end of the sessions on the ‘Keyword View’ of QTP. We have been uncovering its appearance, functions, and capabilities in our articles. We have already covered understanding the view, adding steps, and using conditional statements.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
What You Will Learn:
Other Features of Keyword View
Today you will learn about the remaining features of the Keyword View, such as Shifting steps, Erasing steps, and Managing Breakpoints.
As always, we will use the sample test that we have been working on, which is the login operation on the Flight sample application.
#1) The first and simplest way is to treat the Keyword view like any text editing application when it comes to cutting, copying, and pasting steps. Therefore, all clipboard shortcuts apply.
- Ctrl+C – Copying
- Ctrl+V – Pasting
- Ctrl+X – Cutting
#2) The next method is by using the menu option. To do this, select the step that needs to be moved and choose the following menu options:
- Edit -> Cut
- Edit -> Copy
- Edit -> Paste
#3) Another method is dragging and dropping.
Any of the above methods can be used to move steps. However, there are a few important rules:
- Loop or conditional statements can only be moved in blocks. For instance, for an ‘if…else’ statement, you cannot selectively move the else part.
- In a step where an item is a child object and the user decides to move it, one of two scenarios arises. Either the step remains under the same parent or it is moved to another parent. If it is moved under the same parent, it simply appears in the new chosen position. But if it is moved under a different parent, the parent gets duplicated. Let’s see this visually:
I am going to move the step where we enter the agent’s name (the one highlighted above) under the ‘Flight Reservation’ parent object. Note that the parent object for ‘Agent Name’ is Login. I simply dragged the step to be the last one. Here is how it appears:
Earlier in the introduction sessions, we discussed that we can have multiple actions in a test. Let us see how the Keyword view displays a test with multiple actions and how we can use this view to manage these actions as desired.
To demonstrate this, I am going to convert all the steps under the parent object ‘Flight Reservation’ in our previous example to appear under another action. Adding actions, steps to actions, and more will be discussed in detail in our upcoming sessions.
As you can see in the test flow pane, the sequence of execution for these actions is displayed.
If I want Action 2 to run first, followed by Action 1, the Keyword view allows me to do that by dragging and dropping the actions to the desired position.
With this, we have covered all the information necessary for shifting steps/actions/blocks within a test using the Keyword view.
Deleting steps from QTP could not be easier. Just select the step that you want to remove from the test and press the “Delete” button on the keyboard. Alternatively, you can right-click on a step and choose “Delete” from the menu or select a step and use the “Edit->Delete” option from the main menu.
If a step with sub-steps is selected for deletion, a message appears:
This means that if a step with sub-steps is deleted, all the sub-steps are also deleted.
That’s all we need to know about erasing steps.
Managing Breakpoints in Keyword View
During test execution, there may be certain points where you want to pause the test and observe specific changes. This could be to examine the state of an object or take note of a variable’s value, for example. A useful feature for this is a Breakpoint.
A Breakpoint is a designated point in your test where you want the test run to pause so you can obtain or analyze certain information. Breakpoints often facilitate debugging. Now that we understand what a breakpoint is, let’s learn how to add them to tests from the keyword view.
To add a breakpoint, simply click on the left margin of the specific step where you want the test to pause. A red dot appears in the left margin of the step to indicate the added breakpoint.
This is how it looks:
You can also select a step and press F9 on the keyboard to add a breakpoint.
Lastly, you can use the menu option “Debug -> Insert/Remove Breakpoint.”
Once a breakpoint is added, the test runs normally until it reaches the step with the breakpoint, where it pauses. At this point, you can perform any necessary observations or actions. When you are ready, you can resume the test by choosing the “Run” option from the main menu.
If a breakpoint is added in the keyword view, it is also displayed in the Expert view at the start of the corresponding row.
The opposite is true as well. If you add a breakpoint in the Expert view, it will be reflected in the keyword view.
Adding breakpoints is simple, and removing them is even easier once they have served their purpose or are no longer needed.
To delete a breakpoint, simply click on the line where the breakpoint exists. Pressing F9 on the keyboard or selecting the menu option “Debug -> Insert or Delete Breakpoint” on a step with a breakpoint will also remove it.
This concludes the discussion on all the properties and capabilities of the Keyword view in detail. This view is easier to read compared to the Expert view, and once you understand all the features, you can use it effectively to create robust tests.
The next QTP tutorial will cover how to record a new test and the factors that contribute to its success.