In this fifth installment of QTP VBScript Tutorial series, we would cover the various looping statements that are available in VBScript. Looping statements allow you to repeatedly execute a set of statements multiple times. The number of times the code is executed depends upon many factors such as some loops are executed until a condition is True or False while some other loops are executed a. TUTORIALS POINT Simply Easy Learning Since it is a Hp product, the full support is provided by HP and by its forums for addressing technical issues. DISADVANTAGES: Unlike Selenium, QTP works in Windows operating system only. Not all versions of Browsers are supported and the testers need to wait for the patch to be released for each one of the major versions. Next learn VBScript, the scripting language used with QTP. Refer basics of VB Script Part1, Part2 and Part3. Also learn how to manage the data table with QTP and Excel Part1, Part2, Part3; Once you're comfortable with this much, you are ready to take on a real-world project.
- Guru99 Qtp Tutorial
- Qtp With Vbscript Tutorial Pdf Tutorial
- Qtp Tutorial Pdf
- Qtp With Vbscript Tutorial Pdf Editor
Guru99 Qtp Tutorial
People Also Ask
Qtp With Vbscript Tutorial Pdf Tutorial
In this fifth installment of QTP VBScript Tutorial series, we would cover the various looping statements that are available in VBScript. Looping statements allow you to repeatedly execute a set of statements multiple times. The number of times the code is executed depends upon many factors such as some loops are executed until a condition is True or False while some other loops are executed a fixed number of times. VBScript provides you with the following four looping statements –
- . For Loop
- . Do While Loop
- . Do Until Loop
- . For Each Loop
Asus sabertooth x58 motherboard bios update usb. Let's see each of these four loops one by one.
For Loop
For Loop uses a counter to run a group of statements a specified number of times. Lets see an example of for loop where the codes finds out the sum of numbers from 1 to 10.
In the above example you would have noticed that the counter, i, is incremented by a value 1. If you wish you can change the default value to any other value. This can be done using the Step property. Let's see an example where the code finds out the sum of first 10 odd numbers.
Do While Loop
Do While Loop runs a set of statements while a condition is True. This means that the loop will continue execution till the condition is true and would stop only when the condition becomes false. In a Do While loop the condition can be evaluated at two places. These are –
a) before you enter the loop.
b) at the end of the loop after it has run once. In this case, the loop is executed at least once even if the condition is false because the condition is checked at the end of the loop after it is run once.
Let's see examples of both these types of Do While Loop.
a) Evaluation of condition before entering the loop.
b) Evaluation of condition at the end of the loop after it is run once.
Inventory management system open source. INVENTORY MANAGEMENT SOFTWARE (TO KEEP TRACK OF YOUR GOODS AND AVOID LOSSES) This is an inventory system built with Java Netbeans IDE (You can download the source code from YouTube under Description) It can be used in various businesses ranging from pharmacies, chemists, supermarkets,warehouses, cosmetics stores, electronics stores.etc.
Do Until Loop
Do Until loop is similar to Do While loop with the only difference being that the loop is run until the condition becomes True. In other words, the loop will be executed till the condition is false and would exit only when the condition becomes true. In Do Until Loop also you can check the condition before the beginning or at the end of the loop. Lets take the examples used for Do While loop and see how it can be used for Do Until loop.
a) Evaluation of condition before entering the loop.
b) Evaluation of condition at the end of the loop after it is run once.
In the above examples you would have noticed that the when we used the Until statement, we changed the condition to ‘iCounter > 10'. So here the loop will run till the value of iCounter is less than or equal to 10. The loop would exit only when the value becomes greater than 10.
For Each Loop
For Each loop is different from other loops discussed above for the reason that For Each loop repeats a set of statements for each item in a collection/object or for each element in an array. Let's see some examples of For Each Loop.
Example 1: To find all elements in an array using For Each Loop
Qtp Tutorial Pdf
Example 2: Find all the files in a given folder using For Each Loop
This was all about the basics of the different looping statements that you can use in VBScript. In the next article, we would cover come more aspects of VBScript looping statements.
If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.
To check out more tutorials, visit our QTP Tutorials page. You can also check the Archives page to view the list of all our articles.
Qtp With Vbscript Tutorial Pdf Editor
Related posts: