QTP uses the Visual Basic Scripting Edition (VBScript) scripting language, TestPartner is based on the Visual Basic for Applications (VBA), and RFT’s test script is produced as either a Java or Visual Basic.net application.
VBScript is a subset of the Visual Basic Programming language. The result of the slimming down process is a very small language that is easy to use. JavaScript can do all that VBScript can do and far more. So why use VBScript instead of JavaScript? Because VBScript is much easier to learn than JavaScript.
Visual Basic for Applications (VBA) is another subset of the Visual Basic Programming language for use with Microsoft Word, Excel, Access etc. While it contains a good many features not supported by VBScript, the basic syntax, or construction of the language, is very similar.
RFT is not the main focus for this blog, at least not yet, so for Java vs. VB.NET, you only need to know that Java is programming environment controlled by Sun, and VB.NET is developed by Microsoft.
As said above, both VBScript and VBA are subsets of Visual Basic (VB). The final release of VB was version 6 in 1998. Microsoft’s extended support ended in March 2008 and the designated successor was Visual Basic .NET (now known simply as Visual Basic)
After learning the history of the VB family and JavaScript, let us play a small game by writing the VBScript in a notepad. This is very useful if you do not want to bother to repeat the same thing over and over again.
Copy the following code into a notepad, and save it as kk.vbs, then double click on it, and see what it will do.
Dim fs, file, TSTnumber set fs = createobject( "Scripting.FileSystemObject" ) set file = fs.OpenTextFile( "RF.BAT", 2, true ) For TSTnumber=613 to 616 file.write "VsiColorModeRAW.exe tst-18-0" file.write TSTnumber file.write "\tst-18-0" file.write TSTnumber file.write ".raw.bmode tst-18-0" file.write TSTnumber file.write "\tst-18-0" file.write TSTnumber file.write ".raw.color tst-18-0" file.write TSTnumber file.write "\tst-18-0" file.write TSTnumber file.write ".raw.xml tst-18-0" file.write TSTnumber file.writeline "\Color" Next file.close set fs=nothing
#5: Use QTP to test Log in page redirect function for YouPlayOff.com
In this blog, let’s test the log in redirect function, i.e., from page A, choose log in, then the borrower should be redirected to page A.
This test is complicated, since I want to test multiple starting pages in one action. I would suggest you to try this first by yourself, and I am pretty sure you will have questions, then you can come back to read this blog and solve your questions one by one.
What scripting skills you can practice or learn from this test:
1, Call an existing action (RunAction);
2, Use the DataTable to test multiple inputs;
3, Difference between Global DataTable and Local DataTable (run multiple iterations);
4, How to define variables (Dim);
5, How to wait until certain page is loaded (Sync);
6, How to navigate to a web-page (Navigate);
7, How to handle URLs which contain question mark (?);
8, How to find certain character is in the string (InStr);
9, How to replace characters in a string (Replace);
10, How to use message box (msgBox);
11, How to identify an object from different pages dynamically (Page(“url:=” & PageURL).Link(“text:=” & SignInText));
12, How to use Select Case;
13, How to add comment in the Expert View (‘);
14, How to add a Checkpoint;
15, How to check according to the value from a DataTabel;
16, In order to start next iteration successfully, you need to reset the test environment at the end of the test.
Global Data Table: (you can also read the data from an Excel file directly, see post#9)
http://testing.youplayoff.com
http://testing.youplayoff.com/register
http://testing.youplayoff.com/Login
http://testing.youplayoff.com/create
http://testing.youplayoff.com/categories
http://testing.youplayoff.com/categories/tree
http://testing.youplayoff.com/categories/popular
http://testing.youplayoff.com/playoffs
http://testing.youplayoff.com/recommended
http://testing.youplayoff.com/recent
http://testing.youplayoff.com/groups
http://testing.youplayoff.com/whatsup
http://testing.youplayoff.com/whatsup?show=2
http://testing.youplayoff.com/whatsup?show=3
http://testing.youplayoff.com/help
http://testing.youplayoff.com/about
http://testing.youplayoff.com/privacy
http://testing.youplayoff.com/terms
http://testing.youplayoff.com/contact
Posted by Jia Qi in Quick Test Professional (QTP)