Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on How to run the Bath file using QTP/Vbscript within the QTP forums, part of the Software Testing category; Hi, Please let me know how to run the Batch file using Vbscript/QTP script aswell as how to close the command prompt? Regards, Pradeep...
|
|||||||
|
|||
|
How to run the Bath file using QTP/Vbscript
Hi,
Please let me know how to run the Batch file using Vbscript/QTP script aswell as how to close the command prompt? Regards, Pradeep |
| Sponsored Links |
|
|||
|
Re: How to run the Bath file using QTP/Vbscript
Hi i can do like this for batch testing..........
I have taken 3 tests as a example for doing batch run. They are 1 is display - It will display a message in a word doc. 2 is displaydate - It will display a date and time as a message box. 3 is multiplication- It will display the mathematical table in a Notepad. I converted them into respective functions and saved in notepad as a vbs file.(in C:\VB LIBRARY FILES\) And I wrote a VBS function that is called above 3 functions. and saved as a callAll.vbs( in C:\VB LIBRARY FILES\) Before running this test(BatchTestRun) I loaded all the files into resource tab callAll()'Here i am just calling callAll function which is defined in callAll.vbs File. ************************* display.vbs: public function display() 'To open a word doc,type something and save the doc and close set WordObj = CreateObject("Word.Application") WordObj.visible = true Set WordDoc = WordObj.Documents.Add WordDoc.Range.InsertBefore "Hi Good Morning!" WordDoc.SaveAs "C:\Greetings.doc" WordObj.quit Set WordObj = nothing end function ************************** displaydate.vbs: public function displaydate() 'To display the date in Notepad set fso=createobject("scripting.filesystemobject") set fptr=fso.createtextfile("c:\sample.txt") a=FormatDateTime(Date, 1) msgbox a fptr.writeline a end function **************************** multiplication.vbs: public function multiplication() 'To open notepad and write a mathematical table in that throug QTP and save in C Drive and close Set obj=createobject("Scripting.filesystemobject") Set of=obj.createtextfile("c:\mat.txt") For i=1 to 10 x=5*i of.writeline"5 * "&i&" = "&x Next end function ***************************** CallAll.vbs: public function callAll() display() msgbox "Test 1 is Pass" displaydate() msgbox "Test 2 is Pass" multiplication() msgbox "Test 3 is Pass" end function ******************************* '''''''''''''''Like this we can run multiple tests at a time without using TestBatchRunner Application... '''''''''''''''By putting a flag at end of the each function, we can know that status of the particular test is executed or not. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regarding the convrsion of Vbscript files into .exe form | naveen.kamisetty | QTP | 2 | 10-15-2008 06:02 AM |
| How to write the vbscript in web based applications in qtp? | srinu.tenali | QTP | 2 | 12-20-2007 02:59 AM |
| VBscript tutorial 4 QTP | QuickTestMichael | QTP | 0 | 11-07-2007 08:42 AM |
| How do I 'unpack' and view a .FILE vsam file | Geek_Guest | MainFrame | 0 | 06-26-2007 08:22 PM |
| Frigate3 File Manager: highly configurable and convenient file management environment | JobHelper | Geeks Lounge | 0 | 03-30-2007 02:30 PM |