Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Key view of QuickTest for fine drink (4)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Whether you add objects in the keyword view, add operation steps, or use loops and conditional statements in the keyword view, you need to debug the test script after editing to verify that the test script has logic and syntax errors. to ensure that the script runs correctly. Can QuickTest debug scripts as flexibly as other well-known compilers (such as VS2008, VC6.0)? For example, QuickTest can also debug scripts, is it also possible to set breakpoints and step through? This section explains in detail how to debug scripts in QuickTest.

Breakpoint

Insert a breakpoint by selecting [Debug]-[Insert/Remove Breakpoint] on the menu bar, or pressing F9, or clicking the insert / remove breakpoint button in the toolbar. After you insert a breakpoint, the breakpoint symbol is displayed in the left margin of the keyword view and expert view.

After you set the breakpoint, you can make the test script stop running the session at the predetermined location. After using a breakpoint, the red circle icon in the left margin of the keyword view is represented (the red circle icon in the left margin of the expert view). When the QuickTest test script runs to the breakpoint, it stops running before the corresponding steps are performed at the breakpoint. At this point, you can step through to check the execution effect of the script running to the breakpoint.

Applications of breakpoints:

Pause the running session and check the status of the site or application under test by setting a breakpoint.

Complete the debugging of the test script by setting a breakpoint (marking a point) and executing a step command from that point.

Single-step execution

Single-step execution

By selecting the menu bar [Debug]-[Step Into], you can also click the step button or press F11 to specify that the test script runs to the specified line of the test script. If the test script runs to a line in the test script and needs to call other actions or functions, the called action / function is displayed in the QuickTest window, and the test script stops at the first line of the called action / function entry.

Single-step exit

After calling another operation or function using step. You can select [Debug]-[Step Over] from the menu bar, click the "single step exit" button, or press Shift+F11, and the function modules of the called operation or function will be called one by one, and then return to the calling operation steps and suspend the test script.

Single step skip

By selecting the menu bar [Debug]-[Step Out], you can also click the step Skip button or press F10 to run to a step in the test script. When the operation step calls another operation or function, the called operation / function will be executed as a whole, but the script of the called operation / function and the running process of the called action / function script will not be displayed in the QuickTest window.

Paste the following test script into the QuickTest expert view, and then run the test script using the breakpoint, step out, step out, and step skip commands, respectively.

'#

'define a function myfunc ()

When the function is called, three dialog boxes, one, two and three, will pop up.

'#

Public function myfunc ()

Msgbox "one"

Msgbox "two"

Msgbox "three"

End function

Myfunc

Myfunc

Myfunc

1. As shown in the figure, is the keyword view after pasting the script in the expert view.

two。 As shown in the figure, on line 9 of the keyword view, press F9 to insert the breakpoint, and then run the test script. It can be seen that the test script is suspended after playback to line 9 (the arrow coincides with the breakpoint icon).

3. As shown in the figure, select [Debug]-[Step Into] in the menu bar, or click the single step button, or press F11 to perform a single step. You can observe that the × × arrow enters the myfunc () function (the myfunc () function is called for the first time). After entering the myfunc () function, press F11 three times in a row, and you can observe that three dialogs, one, two and three, pop up respectively, and the position of the × × arrow is constantly changing in the myfunc () function. Finally, the arrow stays outside myfunc ().

4. As shown in the figure, after completing step 3 (the end of the first call to the myfunc () function), press F11 twice in a row to run a single step. When the × × arrow enters the first line of the myfunc () function again, press Shift+F11 to perform a single-step exit (the second call to the myfunc () function), you can see three dialog boxes popping up successively, one, two, and three, while the × × arrow stays in the first line of the myfunc () function. After three dialog boxes pop up, the × × arrow finally stops on the last line of the keyword view (that is, the last call to myfunc ()).

5. As shown in the figure, when the × × arrow stays on the last line of the keyword view, press F10 to perform a single-step skip. It can be seen that three dialogs, one, two and three, pop up successively, while the × × arrow still stays on the last line of the keyword view (when performing a single step, when a certain operation step needs to call other actions or functions, the script of the called action / function will not be displayed in the QuickTest window).

After the three dialog boxes pop up, the playback of the test script ends.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report