In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the conditional sentence and loop sentence of keyword view under QuickTest with both picture and text, which is a series of blog posts with previous blog posts, readers can read continuously and can play a better learning effect.
Key view of QuickTest for fine drink (1)
Http://starpoint.blog.51cto.com/968349/1271835
Key view of QuickTest for fine drink (2)
Http://starpoint.blog.51cto.com/968349/1279828
1. Conditional statement
Through keyword view, you can not only add objects, set object operations, add functions, etc., but also add logical statements to the test script, thus enhancing the flexibility of the test script.
In the actual testing work, it is often necessary to add some logic to the test script, such as: in the process of playing back the test script, if a test object is not detected, how to deal with the test script? Let QuickTest itself do a long search until the QuickTest error message pops up and stop running the test script, or does it allow QuickTest to identify this situation in advance, judge by conditional statements, and stop the script from running? As a qualified test automation engineer, how to make a choice when faced with this kind of problem? It is believed that qualified automation test engineers will first choose to let QuickTest be able to judge the occurrence of this kind of situation, and then terminate the running of the test script. Logic is added to the programming language entry, and logic statements are often used in test scripts, such as conditional statements in this example. All of these operations can be done using keyword-driven testing (view) technology.
Take test scenario 1 as an example, delete the Agent Name object in the scene 1 object library, and after deleting the object, the test script playback will fail. By adding conditional statements to the keyword view, you can determine whether the Agent Name object exists while the script is running, and stop running the script immediately if it does not exist.
two。 Loop statement
Keyword view allows you to add loop statements in addition to conditional statements in the test process.
The flow of the test script can be controlled by looping statements.
Using loop statements, you can repeat a set of actions when the condition is true or until the condition is true.
Use a loop statement to set the number of times a set of steps are repeated.
The loop statements provided by QuickTest are as follows:
While...Wend-A series of statements are executed continuously as long as the specified condition is true.
For...Next-use counters to set the number of times a set of statements are executed.
Do...While-executes a series of statements indefinitely as long as the specified condition is true.
Do...Until-executes a series of statements indefinitely until the specified condition is true.
Design the test scenario and learn the use of loop statements, as shown in the following table:
Test scenario 3
Operation
data
Expected result
Scenario 3
(windows has its own calculator)
1. Click 3
two。 Click 2
3. Click =
The number is 5
1. As shown in the figure, click "Record" to record the test scenario and add the application under test.
two。 Complete the script recording of Test scenario 3 and name the test script Loop. The keyword view for the recording is shown in the figure.
3. As shown in the figure, click the menu bar in the keyword view, select [Insert]-[Loop Statement] or right-click to select [Insert Step]-[Loop Statement] For... Next select statement. In the insert For statement action row, modify the contents of the Value column, change "For Iterator = 1 To 1 Step 1" to "For Iterator = 1 To 3 Step 1", and specify "=" to cycle 3 times.
4. As shown in the figure, select the operation line where the "=" object is located, and drag the object to the For operation line by dragging the mouse.
5. As shown in the figure, play back the test script and observe that the result of the sum is 9.
6. As shown in the figure, in the test results report, you can see that "=" has been cycled for a total of 3 times.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.