I used Anshoo's file from http://relevantcodes.com/executing-q...-qcruntestset/ and it works well running an entire test set on a local machine. I'm trying to run tests on a host group as opposed to local and also add a query to filter out tests that have already run within the test set.
Below is the query
Select ts_name as TestName
from td.TESTCYCL T
inner join td.CYCLE C on c.CY_CYCLE_ID = T.TC_CYCLE_ID
inner join td.CYCL_FOLD cf on c.cy_folder_id = cf.cf_item_id
inner join td.TEST E on e.TS_TEST_ID = t.TC_TEST_ID
Where c.CY_CYCLE = ‘Demo’ and TS_Status != ‘Repair’ and TC_status in (‘No Run’,'Not Completed’)
Order by ts_name
I tried working with this from the help to set up the host group, but have had no luck
'Set up for the run depending on where the test instances
' are to execute.
Select Case runWhere
' Run all tests on the local machine.
Scheduler.RunAllLocally = True
' Run tests on a specified remote machine.
Scheduler.TdHostName = HostName
' RunAllLocally must not be set for
' remote invocation of tests.
' Do not do this:
' Scheduler.RunAllLocally = False
' Run on the hosts as planned in the test set.
Dim TSTestFact As TSTestFactory, testList As List
Dim tsFilter As TDFilter
Dim TSTst As TSTest
' Get the test instances from the test set.
Set TSTestFact = theTestSet.TSTestFactory
Set tsFilter = TSTestFact.Filter
tsFilter.Filter("TC_CYCLE_ID") = theTestSet.ID
Set testList = TSTestFact.NewList(tsFilter.Text)
Debug.Print "Test instances and planned hosts:"
'For each test instance, set the host to run depending
' on the planning in the test set.
For Each TSTst In testList
Debug.Print "Name: " & TSTst.Name & " ID: " & TSTst.ID & " Planned Host: " & TSTst.HostName
Scheduler.RunOnHost(TSTst.ID) = TSTst.HostName
Scheduler.RunAllLocally = False
I'm in over my head on this, wonder if I could receive some guidance.
Patience is like bread I say.... I ran out of that yesterday.
I have not examined Anshoo's code so I can't comment on it directly. I have coded (in Visual Basic 2010) an interface to the OTA API to execute test sets, based on the code available in the HP Support knowledge base article here:
First off, if you want to use the RUN_PLANNED_HOST option, you actually set up the Host Group and Hosts through the QC UI. Have you figured out that part (set up of hosts and hosts groups)? I'm not clear from your post if you understood that distinction. The Hosts and Hosts Groups are set up before this code is used, and this code makes use of the information that was already entered into the UI for that.
Alternately, you can specify an individual remote system on which to run the tests, using the RUN_REMOTE option.
Second, the code you are using (taken from the OTA API example under the TSScheduler object) is intended to run all the automated tests in a test set. The object TSScheduler is not designed to let you pick and choose which tests in a test set to run. The only way you will be able to do that is to write additional code to select the tests you want (run the query you designed) and create a NEW test set containing those tests, and then use the TSScheduler object to run the NEW test set. There is no built-in API facility to allow you to specify individual tests to run.
(Opinions and information contained in this post are wholly my own and do not reflect the opinions of my employer.)