Geeks Talk

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.

How to run the Bath file using QTP/Vbscript

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...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 01-09-2008
Junior Member
 
Join Date: Dec 2007
Location: pune
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
pradeep.madishetti is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-09-2008
Expert Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 112
Thanks: 1
Thanked 19 Times in 15 Posts
rajaputra is on a distinguished road
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.
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


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 07:02 AM
VBscript tutorial 4 QTP QuickTestMichael QTP 1 07-24-2008 05:40 PM
How to write the vbscript in web based applications in qtp? srinu.tenali QTP 2 12-20-2007 03:59 AM
How do I 'unpack' and view a .FILE vsam file Geek_Guest MainFrame 0 06-26-2007 09:22 PM
Frigate3 File Manager: highly configurable and convenient file management environment JobHelper Geeks Lounge 0 03-30-2007 03:30 PM


All times are GMT -4. The time now is 12:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved