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

QuickTest key View (5) script debugging

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

Share

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

Debug viewer

When the test script stops at the breakpoint during the run, or when a step fails, you can debug the script by selecting the Debug option. Select [View]-[Debug Viewer] in the menu bar to call the debug viewer to view, set, or modify the values of objects and variables in the test or component (values are valid only during the current debugging process).

View (Watch) tab

Use the View tab to view the current value of any variable or VBScript object that has been entered in the view list. Under the View tab, enter the object or variable into the Name column and press enter to view the current value in the Value column. If the value of an object or variable changes when the script runs later, the value in the View tab changes as well. You can also manually set the value of the change variable when the test script is paused at the breakpoint.

Variables (Variables) tab

Use the variables tab to view the current values of all variables in the script.

Command (Command) Tab

From the commands tab, you can execute a line of scripts to view, set, or modify the current values of variables or VBScript objects in the test script.

Create a simple test script in scenario 1 and learn how to use the debug viewer.

1. Record test scenario 1 and save the test script as Flight.

two。 As shown in the figure, in the keyword view of the scenario 1 test script, create a new action row where the Item column is set to Statement (declaration) through the drop-down, and the Value column is set to Dim UserName. Create a new action row, where the Item column is set to Statement (declaration) through the drop-down, and the Value column is set to UserName = "mercury". Then drag the new two lines of operation to the front of the operation.

3. In line 4 (AgentName) in the key view, set the current procedure as the breakpoint, as shown in the figure.

4. As shown in the figure, run the test script, pause the test script until the breakpoint, select [View]-[Debug Viewer] in the menu bar, and open the debug viewer.

5. As shown, click the Watch tab in the debug viewer, type username (the variable name defined in step 1) in the Name column, and press enter to observe that the value of username changes to mercury.

6. As shown in the figure, change the value of username to MER. Press F11 to run single-step execution, and you can observe that in the tested application (Flight login box), the value entered by the tested object Agent Name object also becomes MER accordingly.

7. As shown in the figure, stop the test script from running and delete the variables in the Watch tab. Then play back the test script again (the test script is still stopped at the breakpoint), click the "Variables" tab, and you can see that the value of the username variable is taken in "Variables".

8. As shown in the figure, after the script playback process in step 6 stops at the breakpoint, click the "Command" tab, enter username = "MER" in the command tab, and press enter. Press F11 to run single-step execution, and observe that in the tested application (Flight login box), the value entered by the tested object Agent Name object also becomes MER accordingly. The result is the same as in the Watch tab.

Error message

As shown in the figure, in the process of automated testing, QuickTest debugging\ run test scripts often encounter a pop-up error message dialog box, through the pop-up error message dialog box, what information can be obtained? What kind of maintenance should be performed on the test script?

1. Stop (stop)-stop running test scripts.

If QuickTest is configured to display test results after running, test result information is displayed after the test script stops running.

two。 Retry (Retry)-try to perform the current procedure again.

If QuickTest reruns a step and the run passes, the subsequent steps continue.

3. Skip (Skip)-Skip the step that caused the error.

QuickTest skips the step that caused the error and continues from the next step.

4. Debug-pause the script to debug the test script.

Pause the test script, click Debug to enter debug mode, and debug the test script. In debug mode, you can perform any debugging operations such as single-step debugging, single-step execution, and so on. After debugging, you can continue to run the session from the step where the test script stops, or you can use single-step commands to control the rest of the test script.

5. Help (Help)-Open help documentation

For the error message displayed, open the QuickTest-related problem help.

Send test report

It was mentioned earlier that when a test object does not exist, you can use conditional statements to control the test flow and stop the script from running. If the script stops running, how do you determine in the test results that the script stopped because that object does not exist? The reason why the test script stops running can be written into the test results, and the reason for the failure of the script can be seen in the test results, which can provide help for the maintenance of subsequent scripts. This technique is called sending reports (Report). The test report will greatly improve the efficiency of identifying and solving problems.

The sending of test reports (Report) can be set through either the keyword view or the expert view. In the keyword view, this chapter takes the test script recorded in scenario 1 as an example to explain message sending (the test script is stored in the script directory of this chapter-sending message (Flight)).

1. Record scenario 1 and save it, and name the scenario 1 test script send message (Flight).

two。 As shown in the figure, in scenario 1 (send message (Flight) script) test script keyword view, click [Insert]-[Conditional Statement] or right select [Insert Step]-[Conditional Statement] IF... .. conditional statement with Agent Name as a condition.

In the operation row where the IF condition action is located, select the Agent Name object in the Item column drop-down list, and set the Operation column to the Exist,Value column and set it to 1 (the test script detects the existence of Agent Name and the detection time is 1 second).

3. As shown in the figure, in the keyword view, right-click the IF action line inserted in step 1, click [Insert]-[Conditional Statement] or right-select [Insert Step]-[Conditional Statement] to select Else.

4. As shown in the figure, the keyword view inserts the report using the step generator (Report). In the step generator dialog box, select report action (Operation) as ReportEvent and status (EventStatus) as micFail.

5. Drag and drop the add report action line to the Else action line as shown in the figure.

6. As shown in the figure, enter the object library and change the value of the attached text property of the Agent Name object from Agent Name to Name (script playback will fail after modification). Run the test script to observe the cause of the failure in the test results.

The status list of messages (Report) has other states besides micFail. As shown in the table below.

Status table of the message (Report)

Status

Description

Pass (micPass)

After this step is passed, the setting message is sent to the test report.

Failed (micFail)

When this step fails, a setting message is sent to the test report.

Complete (micDone)

Send a setting message to the test report without affecting the pass / failure status of the step.

Warning (micWarining)

Sends the warning status of the step, but does not cause the test script to stop running.

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