Skip to main content

HP QTP Tutorial - Chapter 10

1 Debug

In my previous chapter, I discussed about the features available in Resources Menu such as Object Repository, OR Manager, and Associate Repositories etc. This chapter covers the features available under Debug Menu option. This chapter explains the following features available under Debug Menu:
clip_image002

The features under Debug menu are very useful and also frequently used. Although in most of the cases you use Short Keys. We will cover all these features in detail in this chapter.

1.1 Pause

 There could be case when are you running your script and want to pause (remember Pause and Stop are different things), then you can navigate to Debug->Pause. The script will be paused at the current execution step. You can then do your analysis and then continue with your run by clicking on Automation->Run. Alternatively you can also Press F5 or Run button from the tool bar.
clip_image004

 1.2 Step Into

 There are situation in a script which makes call to other Action or Function. While debugging the Test Script, if we want to navigate to called action or function, then use Step Into debug feature. You can use this feature either by navigating to Debug->Step Into or Press F11. This is also very frequently used debug feature of QTP.

 1.3 Step Over

 This is one of the most frequently Debug Feature of QTP. When you are running the script in Debug mode and want to execute each step at a time, then Step Over feature is used. You can either Press F10 (which most test engineer used to do) or navigate to Debug->Step Over.

 1.4 Step Out

 There could be situation where while debugging you went to Called Action or Function using Step Into and now want to come back into Original Action then you can use Step Out to return to your Main Action. You can either Press Shift+F11 or navigate to Debug->Step Out.

 1.5 Run to Step

 You can use this feature when you want to execute the code from start point to a point in between. For e.g. if you have a action having 100 lines of code and you want to execute from Line 1 to Line 50, then you can use Run to Step feature to execute your code up to Line 50. You can do this by putting cursor to Line 50 and navigate to Debug->Run To Step or press Ctrl+F10 or right click on the expert view at line 50 and select Run to Step from Inline menu.
clip_image006

 1.6 Debug from Step

 The debug from step is also a good feature which will do your script execution till the point where you want to start your debugging. For e.g. if a Test Script is having 100 line of code and you want to start your execution from Step 30, then you can choose Debug->Debug from Step at line 30. You can also start from Line 1 depending on your need. This is also a very good feature.

 1.7 Add to Watch

 Add to Watch is a good feature when you want to analyze the value of the variables during the run and then validate your logic etc. You can add the variable in a watch list and do your analysis during debug process. You normally use Add to Watch in combination with Breakpoint, Debug mode. To use this feature select the value that you want to watch and then either press Ctrl+T or navigate to Debug->Add to Watch. As soon as the variable is added for watch you can see the value in Debug Viewer. See the below screen shot:
clip_image008
This is a very good tool for debugging the test script. As you can see that there are 3 tabs in the debug viewer - Watch, Variable and Command. The usage of these 3 tabs is mentioned below:
Watch – In this tab you can see the value of the variable which you have added to watch. It will show name of the variable, its value and type (what type of variable it is). The value on other 2 fields will be seen when you are in Debug mode.
Variables – In this tab you can see the value of all the variables in the current test script. You do not add it to see the value. This is the default feature of QTP which display the detail of all the variables used in the script. The values are visible only in Debug mode.
Command – In this tab you can overwrite the value of any variable during run time but in debug mode. This is a very handy debug utility and when used appropriately is going to be a boon for test engineers. For e.g. if I want to override default value of a variable during run time then I can use Command tab to override such value.

 1.8 Breakpoint – Insert/Remove/Clear

 Breakpoints are the point where script execution will be halted for further debugging. This is also a very handy debug utility and very frequently used by Test engineers. To insert a break point in a script you just place your blinking cursor on that line of code and either Press F9 or navigate to Debug->Insert/Remove Breakpoint. As soon as you press F9 you will see a red dot circle on the line of code in the test script
.clip_image010
To clear the breakpoint you have to again press F9 on that line of code. There could be instances when you want to clear all the breakpoints in the test script, then you can navigate to Debug->Clear All Breakpoints or press Ctrl+Shift+F9

 1.9 Breakpoint – Enable/Disable

 You can also disable breakpoints instead of removing it. This is needed when you want to execute your script in complete but still want to keep your existing breakpoints. In that case instead of clearing the break points you can disable the breakpoint. You can either disable all breakpoints or specific breakpoints. To disable all break points, navigate to Debug->Enable/Disable All Breakpoints

clip_image012
A disable breakpoint will be shown as a red bordered circle.
To disable an individual break point you can navigate to breakpoint line of code and press Ctrl+F9 or navigate to Debug-> Enable/Disable Breakpoints

 2 References

 Quick Test Professional Tool.

 3 Additional information

 You can email me on Sachin.vasudha@gmail.com with any query.

 4 What Next?

 In my next Chapter I will explain the features of Tool Menu options.

Comments

momna said…
I had been searching such a understandable link where the 'Debug' menu features defined in simple words. Nice work.

Cheers :)
momna said…
I had been searching such a understandable link where the 'Debug' menu features defined in simple words in order to conduct a session in my company. Finally, I'v found that link. Nice work.

Cheers :)

Popular posts from this blog

Is AI taking over your job in software development and testing? 😱"

Are you a software developer or tester feeling threatened by the rise of AI in your industry? 😰 You're not alone. Many professionals in the field are concerned about the potential consequences of AI's integration into software development and testing. While some experts believe that AI can bring significant benefits to the industry, others worry that it could replace human expertise altogether. 🤔 AI algorithms can analyze massive amounts of data and automate many tasks, but they cannot replace the critical thinking and creativity of human beings. Additionally, there are ethical concerns associated with the use of AI in software development and testing. So, what can you do to ensure that you're not replaced by AI in your job? 💪 First, it's essential to recognize that AI is not a replacement for human expertise but rather a tool to augment it. Therefore, it's essential to learn how to work with AI-powered systems to increase your efficiency and productivity. Additi

Revolutionize software testing with AI! 🤖💻 Share your thoughts on ethical implications in the comments.

  As technology evolves, so too does the field of software testing. One exciting development in recent years is the use of AI (Artificial Intelligence) to automate repetitive tasks and improve testing accuracy. Through analyzing large amounts of data and identifying patterns, AI can help identify potential defects or vulnerabilities in software. AI-powered tools can also generate test cases and scenarios by simulating user behavior and input, allowing for more efficient and effective testing. In addition, machine learning algorithms can analyze and learn from past testing data, leading to better predictions and more streamlined testing. AI-powered tools can also help identify and prioritize critical bugs and defects, saving valuable time and effort in manual testing. But it's important to note that AI-powered testing is not a replacement for human testers. While AI can automate certain tasks and help identify potential issues, it's still necessary for human testers to provide a

HP Quality Center - Best Practices

1.Introduction Quality Center is a test management tool which provides very good features for managing both your manual and automated test cases. This paper highlights the best practices for managing your test cases. When you open Quality center, depending on your rights it display the below mentioned option in the sidebar: 1. Requirements 2. Test Plan 3. Test Lab 4. Defects 5. Dashboard 2.Requirements When you have assigned with the responsibility of developing your test cases in the quality center then you must be wondering where to start with. I am going to share my experience to overcome such a situation. You need to find the solution of some question before you start writing your test cases. 1. Is your requirement developed and available? 2. Is your requirement organized in a logical sequence? If answer to both of the above question is Yes, then you can start with Requirement option in the side bar. In case your requirement is under development, then you keep your