Monday, July 29, 2013

QTP 11.5 Batch Test Problems

I wanted to test a GUI application and came across this great software - QTP which automates test cases easily. However, I faced issues with the trial version for Batch Testing. Without the batch test runner, one has to keep repeating "Open-Run-Log Results" cycle for EVERY test case. All of it requires user intervention and it felt that manual testing would be much better.I installed updates but it didn't solve the issue.

Googling facilitated me to find an alternative way to batch test. Some users used their VB Scripting knowledge. One can create a .vbs file with following code:-
 ' on error resume next  
 Dim qtApp 'As QuickTest.Application ' Declare the Application object variable  
 Dim qtTest 'As QuickTest.Test ' Declare a Test object variable  
 Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object  
 qtApp.Launch ' Start QuickTest  
 qtApp.Visible = True ' Make the QuickTest application visible  
   
 ' Set QuickTest run options  
 Set file_Sys=CreateObject("Scripting.filesystemObject")  
 Set Dir=file_Sys.GetFolder("C:\YOUR PATH FOR TESTCase Folder")  
 set test_collection=Dir.SubFolders  
 Set qtresultsObj=CreateObject("Quicktest.RunResultsOptions")  
   
 For each t_folder in test_collection  
      qtApp.Open t_folder.Path,True,False  
      qtresultsObj.resultsLocation=t_folder.path&"\Res1"  
      qtApp.Test.Run qtresultsObj,true  
      qtApp.test.Close  
 Next  
 
 qtApp.Options.Run.RunMode = "Fast"  
 qtApp.Options.Run.ViewResults = False  
   
 Set qtTest = Nothing ' Release the Test object  
 Set qtApp = Nothing ' Release the Application object  
   


This script helps to get away with the QTP's erratic batch test runner. But it has its own pitfalls. Whenever you use this, there are error messages displayed after each execution. 

Batch Test Error

 To overcome, I wrote an application in JAVA which will scan after every interval for such messages and do away with them. 




STEPS for Batch Testing
  1. Make a .vbs file
  2. Copy paste the code as shown above and change the file path to the folder where all your test cases are stored, save it
  3. Download the QTP Batch Runner Helper
  4. Run the Helper and enter the scan interval. (Dont click on "Start" )
  5. Double click on ".vbs" file
  6. While the QTP is loading the test case, go back to "Batch Runner Helper" and click on "Start"

No comments:

Post a Comment