All QTP-UFT Quality Center

Executing QC TestSet via OTA API (QCRunTestSet)

For the past few weeks, I have been actively working on Quality Center (ALM) and its integration with QuickTest Professional. One of the mini-projects I’ve worked on is creating a custom object that executes a test set and sends an email to the supplied distribution list from ALM TestSet’s Automation tab (as shown below):

Note: The above part (EMailTo) can be modified by either hard-coding it, or supplying an input from the Class Constructor.

I’ve extensively used the OTA API Reference to build this object and to understand how the API works. .NET developers having difficulty converting the VBScript code, please post in the comments section and I will mail you the class library (currently only C#).

Download (ALM Only)

QCRunTestSet is available for download, but comes as-is and currently executes TestSets on the localHost. However, I would be more than happy in helping you to modify this code to suit your needs. [for ALM] (6530)

If you’re having issues creating an instance of the TSScheduler object, please read this thread. You may need to upgrade to a higher patch or perform a client registration on the execution machine.

Running QCRunTestSet from CommandLine

If you would like to pass parameters from the CommandLine instead of hard-coding them in the code, use WScript to pass arguments and WScript.Arguments to retrieve them in the class library. Example:

'Passing arguments
wscript C:\QCRunTestSet.cls.vbs "http//<server>:8080/qcbin" myUser myPassword myDomain _
                                                  myProject myTestSetPath myTestSetName
'Retrieving arguments
Set args = WScript.Arguments
QCServer = args(0)
UserName =  args(1)
Password = args(2)
QCDomain = args(3)
QCProject = args(4)
QCTestSetPath = args(5)
QCTestSetName = args(6)

85 comments… add one

Leave a Comment

  • Shalabh Dixit February 10, 2015, 1:27 pm

    Hi ANshoo,
    I’m also getting the same error – unable to create an instance of the Test Director API OLE (Test Director Connection) Object.”
    The code ran fine yesterday but today it got stuck with this error.

    Please help

    Shalabh Dixit

  • Ranjith February 10, 2015, 1:05 pm

    Beautiful and useful website appreciate your hard work.
    Keep going :)

  • Maryam February 1, 2015, 10:57 pm


    I am completely new to software testing tools. I have knowledge of programming and would like to learn testing with QTP.
    Do you have a user manual with the installation CD for QTP so I can study at my own pace?
    I appreciate your help.


  • Pankaj August 15, 2014, 4:44 am

    Hi Anshu,

    You are doing tremendous stuff. Thanks for all this. Your book, co-authored with Tarun Lalwani has helped to clear a lot of doubts too. Though a bit pricey ;). Anyways, I am getting an issue with this startexecution method; I have racked my brains for two days, used the alm uninstaller, installed the tdconnect and qtp addin along with doing the alm client registration four times; but the issue refuses to go away. I have an alm 11 qc server installed in one of my virtual machines. I am using my machine as a client. This client has qtp 10 installed. I am not being able to execute tests using OTA due to this problem. Can you help me with this. Also, the patch which you talked about in the link of sqaforum which you have mentioned requires me to have a contract id to download from the hp site. I don’t have that ; so am unable to download that patch and try see if things work out. Can you help me here. I actually installed a trial version of qtp 11 in the qc server virtual machine hoping that there the issue might not come, but there also the same message about startexecution method comes up. Please help.

    Warm Regards,

    Warm Regards,

  • Anonymous July 23, 2014, 12:28 am


    How We can get link to the current run test result on QC in your Script ?

  • RS June 27, 2014, 1:07 am

    Hi Anshoo, can this script be used for a non-QTP environment, just to kick off the performance tests on HP Performance Center 11? When I try the current code, I get the error in teh Test Run Scheduler ‘Cannot get remoteagent’s classid for test type ‘. I am executing this command remotely (The HP PC server is on another machine). I have installed the HP ALM Client on the machine from where I am executing the test. What other changes do I need to make for this to work?

  • Ronell March 19, 2014, 9:50 am


    I am trying to create a vbs file that will send an email and attach a file (excel file) from the client machine. Does anyone know how to do this?


  • Mini March 11, 2014, 4:40 am

    Anshoo, as always this is very informative and useful. Thanks for sharing.

  • Arijit November 25, 2013, 6:50 am


    I’m preparing a vb script which will generate a report by clicking of a button and it will fetch me all the status updates that happened in QC last week.Please guide me through this or let me know how to proceed on this.Thanks a lot in advance.


  • Ashish Hulgeri September 18, 2013, 12:52 am

    Hi Anshoo,

    I have a folder structure which contains sub folders with multiple test set. Below is example of the folder structure

    Main Folder

    I want to execute all the test sets under “MainFolder”. I tried using the below code. However on using the below code, only the first testset gets executed and execution stops after that. Could you please help me out. Thanks.
    Below is the code that i have used.

    QC_UserName=”QC User Name”
    QC_Password=”QC Password”
    set tdc = createobject(“TDApiOle80.TDConnection”)
    tdc.InitConnectionEx “QC URL”
    tdc.Login QC_UserName,QC_Password
    tdc.Connect QC_Domain,QC_Project
    nPath = “MyFolderPath”
    Set testSetTM=tdc.TestSetTreeManager ‘Create a Tree Manager Object
    Set testFolder=testSetTM.NodeByPath(nPath) ‘Navigate to the Path
    ‘Set tsInstances=tdc.TSTestFactory
    ‘Set tsFilter=tsInstances.Filter
    Set tsList=testFolder.FindTestSets(“”)
    For i=Cnt to 1 Step -1
    Set theTestSet = tsList.Item(i)
    Set Scheduler = theTestSet.StartExecution(“”)
    Scheduler.RunAllLocally = True
    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

    For j= 1 to execstatus.count
    Set TestExecStatusobj =execstatus.Item(j)
    intTestid = TestExecStatusobj.TestInstance
    WScript.Sleep 10000

    Set TestExecStatusobj=Nothing
    Set EventsList=Nothing
    Set execStatus=Nothing
    Set Scheduler=Nothing
    Set tsList=Nothing
    Set testFolder=Nothing
    Set testSetTM=Nothing
    Set nPath=Nothing

    If tdc.Connected Then
    ‘print “Disconnected QC session successfully”
    End If

    ‘ Log off the server
    If tdc.LoggedIn Then
    ‘print “Logged off from the Server successfully”
    End If
    ‘ Print total
    ‘ Release the TDConnection object.

  • Jack August 22, 2013, 10:05 pm

    you post is very helpful.

    i was wondering if you run only the failed test cases in a testset?
    these will not be run on a local host.

    could help me with that?


  • manal August 19, 2013, 10:04 am

    Hello. I need to attach a file to a test run at the end of its execution(when the test passes and when the test fails). Is that possible?
    •When run from test lab, can a component know whether it is the last in the test, or whether it is the last to run in the test (if the test does not complete)?
    •Is the test run object callable from QTP during the running of the test?
    •Is the test run object writable from QTP during the running of the test, or is it locked?
    Your help is much appreciated.


  • Amith July 24, 2013, 12:58 am


    Does the command line script work only when QTP is there? I have automated scripts from TestComplete. After the automated script is executed the test result needs to be recorded in QC run.
    Is this possible using OTA?


    • Anshoo Arora July 28, 2013, 12:22 pm

      Amith, I am not sure how this code will work for TestComplete. How do you currently run them manually? Same like you do with QTP?

  • Pramod Thatti June 16, 2013, 5:23 am


    If i want to run a particular test in a testset how should I go baout doing it.Please let me know.

    Will command does not work?

    For Each testsetfound In tsList
    Set tsFolder = testsetfound.TestSetFolder
    Set tsTestFactory = testsetfound.tsTestFactory
    Set tsTestList = tsTestFactory.NewList(“”)

    ‘now update each test case status
    errmsg = “Error setting up RunFactory”
    For Each tsTest In tsTestList
    ‘If tsTest.Name = testrunname Then
    ‘Set RunFactory = tsTest.RunFactory
    ”Run_Name = “Auto_Run_” & myDate
    ‘Set obj_theRun = RunFactory.AddItem(CStr(testrunname))
    ‘obj_theRun.Status = testresult
    ‘errmsg = “Error posting to QC DB”
    ‘count = count + 1
    ‘End If
    Next ‘end loop of test cases’
    Next ‘end loop of test sets

  • Jay April 25, 2013, 3:58 pm

    So I got it working, but when my test set is done (59 scripts 1.5 hours later) it fails to send email on below line

    TSFolder.Refresh : WScript.Sleep(5000)

    due to the connection being closed(probably a X minute inactivity kickoff). I tried to write the below into the Class_Terminate() but no luck… any help please? Thanks

    Private Sub Class_Terminate()
    If IsObject(TSScheduler) Then
    If Not TSScheduler Is Nothing Then

    ‘JayAvondoglio: TRY: Server Connection was lost so need to disconnect and reconnect here
    On Error Resume Next
    ‘Disconnect TD session

    ‘Disconect and quit QTP
    If IsObject(qtApp) Then
    If qtApp.TDConnection.IsConnected Then qtApp.TDConnection.Disconnect
    End If
    On Error Goto 0
    Call isQCConnected
    ‘JayAvondoglio: END

    TSFolder.Refresh : WScript.Sleep(5000)

    ‘Send an email to the distribution list

    Set TSScheduler = Nothing
    End If
    End If

    On Error Resume Next
    ‘Disconnect TD session

    ‘Disconect and quit QTP
    If IsObject(qtApp) Then
    If qtApp.TDConnection.IsConnected Then qtApp.TDConnection.Disconnect
    End If
    On Error Goto 0

    Set qtApp = Nothing
    Set TDConnection = Nothing
    End Sub

  • Jay April 25, 2013, 1:38 pm

    I love what I see, but right now I have a blank password and it will not allow it. I am sure I can set my password to be something other than blank in QC and this will work, but is there any way to modify it. I tried to take a look using common sense, and have found the location of the error, but am not sure where to tweak it.

    sErr = “Unable to execute RunTestSet. Please provide the ”
    arrArgs = Array(“QCServer”, “UserName”, “Password”, “QCDomain”, “QCProject”, “QCTestSetPath”, “QCTestSetName”)
    bExit = False

    Thanks for any help.

  • Raj December 6, 2012, 4:53 am


    Thanks for the article.
    I have many testsets which I wanted to executed. But each testset contain few Passed scripts and few failed. I just wanted to executed passed scripts only from each test set. So how to modify the code so that it executes testset with custom filters like ‘Status = Failed’

    Appriciate any indicator.


  • Greg Encke September 28, 2012, 2:57 pm


    I want to run only certain tests in a test set and also on a specific host group. I have a query for my selected tests below (basically any test. Also, I just want a simple email that is send when all tests are completed. All of this is very new to me and I appreciate all the help I have already gotten from you.


    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

    • Anshoo Arora October 10, 2012, 3:14 am

      Greg, if you would like to run this using OTA, then how are you running this query against the DB? I assume you’re using a RecordSet object. What does it return?

  • Shiv August 16, 2012, 2:42 am

    Hi Anshoo,

    I wanted to know that, how we can attach the results to the email sending option what you mentioned above. Please help me out in this.


    • Anshoo Arora August 24, 2012, 11:53 am

      Shiv, there are 2 ways you can do this:

      1. Add the emails to the EmailTo field in ALM
      2. Manually specify the recipients in the class library by modifying the caller function:

      Public Sub RunTestSet(Server, UserName, Password, QCDomain, QCProject, QCTestSetPath, QCTestSetName, EmailTo)
          Dim QCTestSetExec, sErr, arrArgs, ix, arg, bExit
          sErr = "Unable to execute RunTestSet. Please provide the "
          arrArgs = Array("Server", "UserName", "Password", "QCDomain", "QCProject", "QCTestSetPath", "QCTestSetName")
          bExit = False
          For ix = LBound(arrArgs) To UBound(arrArgs)
              Execute "arg = " & arrArgs(ix)
              If arg = "" Then
                  MsgBox sErr & arrArgs(ix) & ".", vbOkOnly, "Error!"
                  bExit = True
              End If
          If bExit Then Exit Sub
          Set QCTestSetExec = New QCRunTestSet
          With QCTestSetExec
              .Server = Server
              .UserName = UserName
              .Password = Password
              .QCDomain = QCDomain
              .QCProject = QCProject
              .QCTestSetPath = QCTestSetPath
              .QCTestSetName = QCTestSetName
      		.EmailTo = EmailTo
          End With
          Set QCTestSetExec = Nothing
      End Sub
  • Tracy August 1, 2012, 4:38 am

    Would you please send me the class library, i’m very interested? Thanks

  • Avinandan April 17, 2012, 5:00 am

    Thank a lot. This will also help me to run the scripts in batch mode from command line

  • Narayan April 16, 2012, 10:36 am

    I am not able to successfully execute the vbs file. It reports that the activeX component can not create Object . Please advice

    • Avinandan April 17, 2012, 5:16 am


      If you are running the script in a win7 system then open the command fom Start- Accessaries – Right click on command promt and select “Run as Administrato”. Then go to type
      cd\ Enter
      then CD c:\windows\SysWOW64 Enter
      Now fom this directory run the vbs file.

      Try it out and reply back

    • Kiran March 19, 2015, 10:46 pm

      Hi Avinandan,

      I can find the SysWoW64 under Windows and any folder in my machine?
      Can you suggest me here.


    • Kiran March 19, 2015, 11:40 pm

      Hi Avinandan,

      I can’t find the SysWoW64 under Windows and any folder in my machine?
      Can you suggest me here.


    • Anshoo Arora April 18, 2012, 9:19 am

      Narayan, in addition to what Avinandan said, please also make sure you have ALM/QC 11.0 installed with QTP on the target machine. This error just means the correct COM object was not found, or is not registered.

    • Narasimha June 20, 2013, 10:54 am

      Thank you Avinandan. This has helped me a lot. I was struggling why the script was not ruuning on Win 7 OS. Thanks once again…

    • Anshu Khandelwal March 10, 2014, 6:21 pm

      Adding more to Avinandan and Anshoo comments,another resolution is try reinstalling TDConnectivity Add in again, it can be also possible reason and quick permanent fix.
      It’s works for me that’s why thought to share.

  • Amit Chaudhary March 26, 2012, 6:03 pm


    I have a QC test which is automated using QTP, i want to run that test case automatically. Help please.

    I tried the way it’s mentioned in this thread but it’s not working.

    can someone help me here ?


    • Anshoo Arora March 28, 2012, 9:32 am

      Amit, this article will execute the entire Test Set. Also, there are some commands used which are only available with QC 11.0. If you are using version 11.0, can you share the code you’ve used to execute the Test Set?

    • Amit Chaudhary April 19, 2012, 4:58 pm
      Dim TSetFact, tsList 
      Dim theTestSet 
      Dim tsTreeMgr 
      Dim tsFolder
      Dim Scheduler 
      Dim execStatus 
      Dim tdc
      Dim nPath
      Dim TSTestFact, testList
      Dim tsFilter
      Dim TSTst
      Set tdc = CreateObject("TDAPIOLE80.TDConnection")
      If (tdc Is Nothing) Then
      MSGBOX "Connection is not created"
      MSGBOX "Connection is created"
      End If
      tdc.InitConnectionEx ""
      tdc.Login "685495", "Syntel24"
      tdc.Connect "BSTATS", "fedex-com-FedExWebIntegWizard"
      Set TSetFact = tdc.TestSetFactory
      Set tsTreeMgr = tdc.TestSetTreeManager
      nPath = "Root\" & Trim("SANDBOX\Amit Chaudhary")
      MSGBOX nPath
      Set tsFolder = tsTreeMgr.NodeByPath(nPath)
      If (tsFolder Is Nothing) Then
      MSGBOX "Folder is not found"
      MSGBOX "Folder is found"
      End If
      Set tsList = tsFolder.FindTestSets("OTA")
      If tsList.Count > 0 Then
      MSGBOX "FindTestSets found more than one test set"
      ElseIf tsList.Count < 1 Then
      MSGBOX "FindTestSets: test set not found"
      End If
      Set theTestSet = tsList.Item(1)
      'MSGBOX theTestSet.ID
      'Set TSTestFact = theTestSet.TSTestFactory
      'Set tsFilter = TSTestFact.Filter
      'tsFilter.Filter("TC_CYCLE_ID") = theTestSet.ID
      'Set testList = TSTestFact.NewList(tsFilter.Text)
      'For Each TSTst In testList
      'MSGBOX "Name: " & TSTst.Name & " ID: " & TSTst.ID 
      Set Scheduler = theTestSet.StartExecution("")
      Scheduler.RunAllLocally = True
      Set execStatus = Scheduler.ExecutionStatus
      'MSGBOX execStatus
      set obj = theTestSet.StartExecution("LocalHost")
      obj.RunAllLocally = True
      Set tdc = Nothing
    • Anshoo Arora May 2, 2012, 1:44 pm

      Amit, the one thing you are missing is the part where you have to wait until the execution is complete. You will have to retrieve the Scheduler status and check if it has finished execution. Besides this, your code seems correct. You didn’t specify it though – what is the issue you are having?

    • Anonymous August 7, 2012, 3:59 pm

      Hi Anshoo,

      Sorry, i was away from this project for a while. Can you please help me to resolve the issue as you mentioned of wait until execution is completed ?

      Issue is – test cases status is not initiating for execution ?

      Many thanks in advance for help !


    • Anonymous August 9, 2012, 11:41 am

      Getting error – ActiveX component can’t create object.

    • jyboo February 19, 2015, 10:30 am

      first login to HP QC with valid credentials, project and domain, click–> help –> add-in –> click Register and wait for the process to complete

    • Amit August 14, 2012, 4:48 pm

      Hi Anshoo,

      Still the issue is not resolved, can you please quickly check on some solution for this ?

    • Anshoo Arora August 24, 2012, 11:08 am

      Amit, you were missing the polling mechanism:

      Private Sub WaitWhileTestRunning(ByVal ExecutionStatus)
          Dim RunFinished: RunFinished = False
          While RunFinished = False			
              ExecutionStatus.RefreshExecStatusInfo "all", True
              RunFinished = ExecutionStatus.Finished
      End Sub
    • Anshoo Arora August 24, 2012, 11:51 am

      Amit: Are you still getting an ‘ActiveX cannot create Component’ error?

    • Amit Chaudhary August 24, 2012, 11:54 am

      Hi Anshoo,

      Error is gone now,but actual test case is not runinng.

      FYI…it’s a BPT test case.

      Help please.


    • Amit Chaudhary September 26, 2012, 9:31 pm

      Hi Anshoo,

      Can you please help me on this ?

      Amit Chaudhary

    • Anshoo Arora October 10, 2012, 3:12 am

      Amit, I am not sure what is causing it. Use the library in this post and run the following command:

      Call RunTestSet("", UserName, Password, "BSTATS", "fedex-com-FedExWebIntegWizard", "Root\" & Trim("SANDBOX\Amit Chaudhary"), "OTA")

      What behavior do you see? Does the test set run? Are there any error messages? Does an incorrect test set run?

      One other thing, are there any other test-sets with the word “OTA” in them?

  • mtl March 22, 2012, 12:47 pm

    Hi Anshoo,

    I am using ALM 11 and QTP 11. I updated your code with my testset info and run it from the command line. After the testset finish running, the Test Run Scheduler still active. After a couple of minutes, the same testset automatically ran again. Why is that?

    • Anshoo Arora March 28, 2012, 9:29 am

      MTL: I am not sure why this would happen. I tested this library in the morning via command line and the Test Set was run only once and there was no execution afterwards. Please share the code you’ve used to run via command line.

  • SAM March 13, 2012, 2:40 am

    Hi Anshoo,

    Query on – QC 11-QTP11 Integration

    Precondition :- Selected 4 qtp scripts in QC TEst Set and Selected only 2 and run them
    Problem :-
    When it start execution, it opens QTP and run the first selected script multiple times and does not stop ?

    Is it a known issue ? Or is there any workaround ?

    Thx for your time,


    • Anshoo Arora March 15, 2012, 9:28 am

      Sam, I haven’t encountered this issue. Are you on the current patch level for QC? Can you share the code?

    • SAM March 23, 2012, 1:42 pm

      Hi Anshoo,

      Unfortunately cannot share the code.. But this is very weird scenario observed.. will try on few other scripts and will keep posted ..

      Thx for ur time

    • SAM March 23, 2012, 1:43 pm

      Can u please elaborate ‘Current patch level’for QC.. Do I need to check with QC 11.0’s latest patch on HP site ?

    • SAM August 5, 2012, 7:47 am

      Hi Anshoo,

      Got to know the issue – its with Datatable issue with QTP 11 and QC 11 integration and there is a patch for it. Even though patch works fine but the issue is really a major one with this 11.0 version


    • Anshoo Arora August 7, 2012, 10:52 am

      Sam, are you on version 11.0 or 11.5? Patch 01 for 11.5 was released last night.

  • Ashish Kumar Singh March 9, 2012, 8:18 am

    just to add to previous question i have been using QTP11.0 with QC9.2.

  • Ashish Kumar Singh March 9, 2012, 8:03 am

    Hi Anshoo
    I was trying to run the vbs file through command prompt with little modification in user name,password,domain,i have been getting an erros “Invalid server response”, please let me know what could be the reason.

    • Anshoo Arora March 15, 2012, 9:16 am

      Ashish, this library is only compatible with ALM (QC 11.0).

    • Jay April 25, 2013, 3:14 pm

      I may have gotten around this issue below…

      ‘TSReport represents the execution report settings for the current test set
      ”TODO::may need to comment this out and hardcode, while on QC 10.00
      ‘ Set TSReport = TestSet.ExecutionReportSettings
      ‘ TSReport.Enabled = True

      ‘This retrieves the EMail list from the recipients list from QC
      ‘ EMailTo = TSReport.EMailTo : Me.EMailTo = EMailTo
      EMailTo = “javondo”

  • Avinandan March 7, 2012, 2:09 am

    Hi Anshoo,

    I have installed your solution on XP and executed succefully. But recently I upgraded my OS to WIN7. And during run in Win7 I am getting following error “unable to create an instance of the Test Director API OLE (Test Director Connection) Object.” Please help me to resolve.

    • Arnold March 8, 2012, 6:47 pm


      open notepad and save this as a bat file:

      bcdedit /set {current} nx Alwaysoff

      Run bat file.

    • Anshoo Arora March 15, 2012, 8:59 am

      Avinandan, this should only occur if the following statement fails:

      Set TDConnection = CreateObject("TDApiOle80.TDConnection")

      Do you have the QC add-in installed on this box?

    • Jay April 25, 2013, 3:16 pm

      I had the same issue and I fixed it like so(in my case due to 32/64 bit):

      C:\Windows\SysWOW64\wscript C:\QualityCenterSchedul……..

    • Jay April 25, 2013, 3:57 pm

      So I got it working, but when my test set is done (59 scripts 1.5 hours later) it fails to send email on below line

      TSFolder.Refresh : WScript.Sleep(5000)

      due to the connection being closed(probably a X minute inactivity kickoff). I tried to write the below into the Class_Terminate() but no luck… any help please? Thanks

      Private Sub Class_Terminate()
      If IsObject(TSScheduler) Then
      If Not TSScheduler Is Nothing Then

      ‘JayAvondoglio: TRY: Server Connection was lost so need to disconnect and reconnect here
      On Error Resume Next
      ‘Disconnect TD session

      ‘Disconect and quit QTP
      If IsObject(qtApp) Then
      If qtApp.TDConnection.IsConnected Then qtApp.TDConnection.Disconnect
      End If
      On Error Goto 0
      Call isQCConnected
      ‘JayAvondoglio: END

      TSFolder.Refresh : WScript.Sleep(5000)

      ‘Send an email to the distribution list

      Set TSScheduler = Nothing
      End If
      End If

      On Error Resume Next
      ‘Disconnect TD session

      ‘Disconect and quit QTP
      If IsObject(qtApp) Then
      If qtApp.TDConnection.IsConnected Then qtApp.TDConnection.Disconnect
      End If
      On Error Goto 0

      Set qtApp = Nothing
      Set TDConnection = Nothing
      End Sub

    • Jay April 25, 2013, 3:59 pm

      Please delete this duplicate comment(and this one). Sorry, could not remove myself.

  • Nitin February 6, 2012, 2:32 am

    Hi ,
    I have a different problem. I hope Anshu or someone could help.
    I an trying to write an exe using QC OTA to update the status of my test cases in QC.I am facing two issues:

    1. When I am using run.Status =”Pass”; getting an error saying Field requires a value from the corresponding list

    2. How to provide several other information for test case updation like OS,Locale,IE version, Product Version.

    I am using QC on Win7 SP1 Ultimate32 bit

    My code snippet is

    foreach (TSTest tsTest in tsTestList)

    { Console.WriteLine(tsTest.Name);

    Run lastRun = (Run)tsTest.LastRun;
    RunFactory runFactory = (RunFactory)tsTest.RunFactory;
    String date = DateTime.Now.ToString(“yyyyMMddhhmmss”);
    Run run = (Run)runFactory.AddItem(“Run” + date);
    run.Status = “Pass”;


    Any help in this regard is highly appreciated as this is the first time I am using QC.

    • Parul March 23, 2012, 5:43 am

      Hi Nitin,

      you need to pass the status “Passed” insted of “pass”.
      I hope it will work for you.


  • Karan November 10, 2011, 11:16 pm


    I had a small concern as this coode works superb but TestSet.Tefresh does not work and i get the same status of the test case in the test set.

    Please let me know how to change the status or maybe refresh the status of a test script.

  • Arnold October 25, 2011, 9:06 pm

    Is this compatible with QC9.2?

  • Paulo September 6, 2011, 9:10 am

    Is it possible to filter witch tests of the TestSet should be executed? For example: in the last execution 2 tests of a 10 tests Testset failed and I only want to execute those 2 that failed. Is that possible to archive via the OTA API?

  • mehmet June 6, 2011, 6:45 am

    Hi very good implementation, thanx.
    My test sets take parameters.
    How can i set test set parameters with this function?

  • Drunlar April 13, 2011, 5:30 pm

    Cherry the “TD object not found” error message can be a few different things. In order for this script to work you must be able to run QC from IE (Not QCExplorer.exe). Also if you are using a 64 bit system the script must be ran from a 32 bit prompt…
    %windir%\SysWOW64\cscript.exe //nologo …

    If you are using a 64 bit system getting QC 9.5 running in IE is a complicated setup.

  • AK April 5, 2011, 6:29 am

    Hi Anshoo,
    I need to download report from QC via vb script or QTP Script.Can u help me in doing this?I need this urgently.


  • Cherry March 24, 2011, 11:12 am

    Can anyone share the VB script to Connect ALM 11/QC11 and QTP10.00.
    I see an error TD object not found
    I had this script – Used to download the file from QC to Temp Directory

    Func_GetFolderAttachmentPath(sTDFolderPath, sTDAttachmentName)

    Dim oAttachmentFactory, oAttachment, oAttachmentList, oAttachmentFilter, oTreeManager, oSysTreeNode, iNdId,sPath
    Set oTreeManager = QCUtil.TDConnection.TreeManager
    Set oSysTreeNode = oTreeManager.NodeByPath(sTDFolderPath)
    Set oAttachmentFactory = oSysTreeNode.Attachments
    Set oAttachmentFilter = oAttachmentFactory.Filter
    iNdId = oSysTreeNode.NodeID
    oAttachmentFilter.Filter(“CR_REFERENCE”) = “‘ALL_LISTS_” & iNdId & “_” & sTDAttachmentName & “‘”
    Set oAttachmentList = oAttachmentFilter.NewList

    If oAttachmentList.Count > 0 Then
    Set oAttachment = oAttachmentList.Item(1)
    oAttachment.Load True, “”
    sPath = oAttachment.FileName
    End If
    Func_GetFolderAttachmentPath = sPath
    Set oAttachmentFactory = Nothing
    Set oAttachment = Nothing
    Set oAttachmentList = Nothing
    Set oAttachmentFilter = Nothing
    Set oTreeManager = Nothing
    Set oSysTreeNode = Nothing

    End Function

  • Srinivas March 22, 2011, 12:55 pm


    I am currently using QTP 10 and QC9.5. Can any body help me out how to download scripts, attachments etc… from qc to local machine so that i can run from local machine and fix the fixes to the code.

    • Anshoo Arora June 29, 2011, 7:22 pm

      Srinivas: After connecting QTP to QC from your machine, you can open any of the resources in Quality Center from QTP.

    • Srinivas March 8, 2012, 1:40 pm

      Hi Anshoo, As per the client requirement we need to download all the resources which are there in QC to local machine and map them (resources) to locally and execute them. Its a one time activity to download them for the test cycle. Can you explain how we can do this. One of my colleague said we can do it using OTA to download and map the resources locally but not sure about it. Can u send any relevant code for the same.

      Thanks in advance

    • Anshoo Arora March 15, 2012, 9:13 am

      Srinivas, I cannot send you the code as I do not have access to ALM. Your colleague has pointed you in the right direction though. First, download the resources to local machine, use LoadFunctionLibrary to associate. You can also directly connect to ALM before running the test and use resources directly from ALM.

  • shiva March 3, 2011, 1:17 am

    can any one help me ,
    how to automate test cases from JSP(java)

  • subrata fouzder February 21, 2011, 11:09 am

    Hi Anshoo
    This is very generic question regarding Testing
    Our software has its own Object model and corresponding methods .attributes defined ( taken fro VB). Now in the new requirement another new 2 editors are getting added C# and VB.NET so users can use this two editors for Scripting.I have to test this scenario whether the Object model is ported correctly to C# and .NET or not.
    Can you suggest any suitable automation method for this?
    Thanks in advance

  • AK February 3, 2011, 9:13 am

    Hi ,

    Can QC can be installed at my home system , I mean is it freely available or licence one.If it is can u plz provide me the link of the site from where i can download it.


    • Anshoo Arora February 19, 2011, 7:08 am

      AK: I believe you can download a trial version for a short period of time. The last time I installed QC, the trial version lasted for 30 days. You will be directed to the downloads section from this link + you will need to be registered to download the software.

    • Kumar April 13, 2013, 10:05 am


      How to export QTP batch test results to QC using OTA API.
      For example I have three manual test cases in QC(id :100,101,102)for those manual test cases I have three automation scripts. I wan to execute these three automation scripts from QTP and want to send the results to QC(just update the manual test case status as PASS OR FAIL in QC automatically).Please help me.


  • Raja February 2, 2011, 4:33 am

    Hi Anshoo,

    I have saved one excel sheet in Test Resources of QC. But I am not able to access that excel sheet value.

    Can you please let me how can we access the excel sheet saved in QC.


  • Anonymous January 26, 2011, 12:21 pm


    I removed the code to send an email from the VBS file and executed it from CMD. Noticed the status of each script initially is N/A and for couple of scripts the status remained same, in other words only FEW scripts from testset were executed.
    I am unable to see the results in CMD prompt (not sure if it shows any) as the scripts close all open files(browsers and cmd prompts at the start of each script ). How can I check the executionStatus of the Execution Controller (TSScheduler) when scripts are executing ,can you please shed some light?
    I’m not sure why some of the scripts in test set are not being executed. Thanks in Advance!

  • Sri January 25, 2011, 4:44 pm

    Hi Anshoo,

    I executed the vbs file from commandline, received an error “Object doesn’t support this property or method: ‘TestSet.ExecutionReportSettings’

    All I did is updated theVBS file with the values to the QC URL,ID/pwd,test folder and testset.
    Executed using cscript.exe QCRunTestset.cls.vbs

    Also, We are using QualityCenter 10.0 and QTP 10.0 versions.I do not see select Fields section under Automation tab in QC to notify by email. Is this something customized by QC Admin?or QC 11.0 feature?
    I would love to do the same setup, receive an email with Test results report.

    PS. I am trying to perform get this setup so scripts can be executed automatically following builds.

    • Anshoo Arora June 29, 2011, 7:21 pm

      Sri: You received this error because the Interface ITestSet2 was introduced in QC 11/ALM. There are several enhancements made to this code and it only supports version 11.