Reputation: 560
I am attempting to invoke a test suite in ALM programmatically. I have no issue running the specified test suite on my local machine when I execute the code (when my machine acts as a test runner). I run into an issue however when I attempt to point to a remote server to run said test suite. Code and error message posted here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TDAPIOLELib;
// Connect to ALM
ITDConnection itdc = new TDConnection();
itdc.InitConnectionEx(url);
itdc.ConnectProjectEx(domain, projectName, username, pswd);
if (itdc.ProjectConnected)
{
List<string> testInfo = new List<string>();
string testFolder = "Root\\<Folder>\\<Folder>";
testSetName = "<TestSuite>";
TestSetFactory tsFactory = (TestSetFactory)itdc.TestSetFactory;
TestSetTreeManager tsTreeMgr = (TestSetTreeManager)itdc.TestSetTreeManager;
TestSetFolder tsFolder = (TestSetFolder)tsTreeMgr.get_NodeByPath(testFolder);
List tList = tsFolder.FindTestSets(testSetName, false, null);
TestSet testset = tList[1];
TSScheduler scheduler = testset.StartExecution("<RemoteServerName>"); // Contain server name unless local
// scheduler.RunAllLocally = true; // Included when ran local
scheduler.Run();
}
The error message I recieve at the 'scheduler' declaration line is "Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))".
I have registered the OTAClient.dll on both my local machine and the machine that I have attempted to execute on.
Any suggestions would be appreciated.
Upvotes: 0
Views: 3629
Reputation: 605
I was already using
TSScheduler scheduler = testSet.StartExecution("");
We had a working solution in QC10, but recently upgraded to QC12. Installing the connectivity located at
allowed us to use the COM object in VS2013 / C#, connect to QC etc but would fail with the same error you had on the code above.
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Eventually we found that you also need to 'register your client' by going to tools/client registration:
Running IE as admin, and installing the components on that page.
I hope this helps someone :)
Upvotes: 2
Reputation: 560
I figured out what the issue was. It would be nice if there was more documentation available on this library.
You need to set a few TSScheduler properties before the execution can commence. So this line:
TSScheduler scheduler = testset.StartExecution("<RemoteServerName>"); // Contain server name unless local
// scheduler.RunAllLocally = true; // Included when ran local
scheduler.Run();
Became this:
TSScheduler scheduler = testset.StartExecution(""); // Contain server name unless local
scheduler.TdHostName = "<test_runner_name>";
scheduler.LogEnabled = true;
scheduler.Run(testset.ID);
Also would be a good idea if you confirm that you have all of the necessary ALM add-ins installed on your machine. Specifically the "HP Quality Center Connectivity" and "HP Quality Center System Test Remote Agent" add-ins. I re-installed on my test agents just to be sure.
Hope this helps someone else in the future.
Upvotes: 2