Automation Testing

QC & QTP How to schedule a recurring test set

By Test Guild
  • Share:
Join the Guild for FREE

Problem – Quality center's issue with running periodic test sets

This has been a long standing issue with me and Quality Center. You can use QC to schedule a testset to run at a given time but the issue is when you need to have a testset run at a recurring time — say every day at 5:00 am.

Solution

To get testsets to run periodically you can use Vbscript with QC's OTA API and Windows scheduler.

VBScript code needed to run test set in QC

First you need to setup a VBScript that calls the Quality Center's testset that you want to run:

set tdc = createobject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://qcURL/qcbin/"
tdc.login "yourUserName","yourPassword"
tdc.Connect "yourDomain","yourProject"

Set objShell = CreateObject("WScript.Shell")
Set TSetFact = tdc.TestSetFactory
Set tsTreeMgr = tdc.TestSetTreeManager
Set tsFolder = tsTreeMgr.NodeByPath("Root\Formal Tests\YourTestDirectory")
Set tsList = tsFolder.FindTestSets("Your TestSet name. This is case sensitive!")
 
Set theTestSet = tsList.Item(1)
Set Scheduler = theTestSet.StartExecution("")
Scheduler.RunAllLocally = True
Scheduler.run

Set execStatus = Scheduler.ExecutionStatus

Do While RunFinished = False
 execStatus.RefreshExecStatusInfo "all", True
 RunFinished = execStatus.Finished
 Set EventsList = execStatus.EventsList

 For Each ExecEventInfoObj in EventsList
  strNowEvent = ExecEventInfoObj.EventType
 Next

 For i= 1 to execstatus.count
  Set TestExecStatusobj =execstatus.Item(i)
  intTestid = TestExecStatusobj.TestInstance
 Next
Loop

Window's Scheduled Tasks for Running Tests

Next you need to setup the windows scheduler to run at the desired time. See video for step by step instructions.

RunTestSet.exe – Another option

If you do not want to create your own VBScript to run your test sets you can also try an unsupported tool from HP – RunTestSet.exe.

RunTestSet is a VC++ console application that you can send command line options to in order to run a QC a test set. You can download RunTestSet and its documentation from HP or from https://testguild.com/downloads

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

The 4 Destroyers of Any Automation Test Script

Posted on 09/05/2023

After interviewing over 500 test engineers on my podcast, I've identified the four ...

Unraveling the Automation Scorecard: Where Do You Stand?

Posted on 08/03/2023

Do you know what your Automation Scorecard Score is? No? Not sure you ...

3 Time Saving AI Assisted Features for Testers (Katalon Studio)

Posted on 07/11/2023

The software testing landscape is rapidly evolving, with artificial intelligence (AI) and machine ...