QTP Instructional Guide #5 – Shifting Steps, Deleting Steps, and Handling Breakpoints in Keyword view. This is the fourth and concluding write-up about QTP Keyword view capabilities.
We are quickly approaching the end of the sessions on QTP’s ‘Keyword View’. Its visual aspects, functionalities, and features have been the focus of our write-ups. We have already gone over understanding the view, incorporating steps, and the use of conditional expressions.
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:
Additional Features of Keyword View
Today, you will discover the rest of the features of the Keyword View, including Transferring Steps, Removing Steps, and Handling Breakpoints.
Just like before, we’ll use the sample test that we’ve been working on; this test is the login operation on the Flight sample application.
#1) The most straightforward way is to treat the Keyword view in the same way as you would any text editing program regarding cutting, copying, and pasting steps. Clipboard shortcuts apply as is here.
- Ctrl+C – For Copying
- Ctrl+V – For Pasting
- Ctrl+X – For Cutting
#2) The other method is using the menu option. You can do this by selecting the step you want to move and then choosing the following menu alternatives:
- Edit -> Cut
- Edit -> Copy
- Edit -> Paste
#3) One more approach is the drag-and-drop technique.
You can employ any of the above strategies to transfer steps. However, there are a few key points to remember:
- Loop or conditional statements must be moved as a complete section. For example, you cannot selectively move the else part of an ‘if…else’ statement.
- There are two possible outcomes if a step involving a child object is selected to be moved. It either stays under the same parent or is relocated to another parent. If it remains under the same parent, it simply shows up in the new chosen place. But if it is relocated under another parent, the parent gets replicated. Let’s illustrate this visually:
I plan on moving the step where we type in the agent’s name (the highlighted one above) under the ‘Flight Reservation’ parent object. Notice that the parent object for ‘Agent Name’ is Login. I simply dragged the step to make it the last one. Here’s how it looks:
In the introductory sessions, we explained that a test can contain multiple actions. Let’s look at how the Keyword view displays a test with multiple actions and how we can use this view to arrange these actions as desired.
In order to illustrate this, I’m going to transfer all the steps under the parent object ‘Flight Reservation’ from our previous example to appear under another action. Adding actions, inserting steps into actions, and much more will be discussed in-depth in our future sessions.
As displayed in the test flow pane, the sequence of execution for these actions is shown.
If I desire Action 2 to be executed first, followed by Action 1, the Keyword view permits me to do so simply by dragging and dropping the actions into the desired place.
With this, we have discussed all necessary information for transferring steps/actions/sections within a test using the Keyword view.
Eliminating steps from QTP is a straightforward process. Simply pick the step you want to delete from the test and press the “Delete” key on your keyboard. Alternatively, you can right-click on a step and click “Delete” from the menu or pick a step and use the “Edit->Delete” menu option.
If a step with sub-steps is chosen for removal, the following message is displayed:
This means that if a step with sub-steps is deleted, all subordinate steps are removed as well.
That’s everything we need to know about removing steps.
Handling Breakpoints in Keyword View
During the execution of a test, there may be certain instances when you would want to pause the test and observe specific changes. This could involve examining the state of an object or recording the value of a variable, for instance. Breakpoints serve this purpose efficiently.
A Breakpoint is a specific point in your test where you want the test run to halt to collect or assess certain data. Breakpoints can be very helpful for debugging. Now that we understand what a breakpoint means, let’s see how to implement them to tests via the keyword view.
To introduce a breakpoint, simply click on the left border of the specific step at which you want the test to stop. A red dot will appear in the left margin of the step to signify the newly added breakpoint.
This is what it looks like:
Apart from this, you can choose a step and press F9 on your keyboard to incorporate a breakpoint.
Finally, you can use the menu option “Debug -> Insert/Remove Breakpoint.”
Once you have added a breakpoint, the test continues as usual until it reaches the step where the breakpoint is set. The test then stops at this point for you to carry out any necessary observations or actions. After you are done, you can continue the test by choosing the “Run” option from the primary menu.
If a breakpoint is set in the keyword view, it is also displayed in the Expert view at the start of the corresponding row.
The reverse is also true. If you implement a breakpoint in the Expert view, it is displayed in the keyword view.
Adding breakpoints is quite simple, and getting rid of them is straightforward once they have fulfilled their purpose or are no longer required.
To eradicate a breakpoint, simply click on the line where the breakpoint is present. Pressing F9 on your keyboard, or selecting the menu option “Debug -> Insert or Delete Breakpoint” on a step with a breakpoint will also remove it.
This brings us to the end of our comprehensive discussion on all the attributes and potential of the Keyword view. It’s easier to comprehend compared to the Expert view, and once you become familiar with all of its features, you can effectively use it to build robust tests.
The following QTP tutorial will delve into how to record a new test and the elements that contribute to its success.