I am looking to connect HP quality center using C# and ASP.net. Can someone please suggest me a way to connect it using .net web application. Also, do i need to do any installation on my server where my application is hosted?
Below is some java code i found, I want something like this
//Connect to QC
ITDConnection itdc= ClassFactory.createTDConnection();
System.out.println(itdc.connected());
itdc.initConnectionEx("http://QC.com/qcbin");
System.out.println(itdc.connected());
itdc.connectProjectEx("DomainA", "ProjectB", "UserID", "Password");
Well, there are two ways of doing this. These are using:
OTA Client (Open Test Architecture)
This is the traditional way of connecting with HP QC/ALM from a third party app. This API has been available for many years and is quite mature in terms of the interactions it allows with QC. However this API I believe is COM based and is fast becoming outdated. Therefore I wouldn't recommend using this to build extensive custom QC harnesses.
REST API
HP has started providing a REST API for QC in their last few version. The REST API in the latest version of QC (now known as HP ALM 11.5) seems to be quite mature. I'd say the main advantage of this would be speed and better interoperability as I believe REST is fast becoming one of the main stream standards for exposing remote services.
That was some background on your options. However to give some examples of the code in C#, see the following code snippet.
using TDAPIOLELib; // This is the QTP interop library
private TDConnection qcConnection;
private string Connect()
{
string status;
status = "Initialising";
qcConnection.InitConnectionEx("<QC URL>");
qcConnection.ConnectProjectEx("<QC Domain>", "<QC Project>", "<LoginUserId>", "<UserPassword>");
if (qcConnection.ProjectConnected)
{
status = "Connected";
}
return status;
}
public void GetTestsInTestSet(string testFolder, string testSetName)
{
TDAPIOLELib.List tsTestList = new TDAPIOLELib.List();
try
{
if (qcConnection.ProjectConnected)
{
TestSetFactory tSetFact = (TestSetFactory)qcConnection.TestSetFactory;
TestSetTreeManager tsTreeMgr = (TestSetTreeManager)qcConnection.TestSetTreeManager;
TestSetFolder tsFolder = (TestSetFolder)tsTreeMgr.get_NodeByPath(testFolder);
List tsList = tsFolder.FindTestSets(testSetName, false, null);
foreach (TestSet testSet in tsList)
{
TestSetFolder TSFolder = (TestSetFolder)testSet.TestSetFolder;
TSTestFactory TSTestFactory = (TSTestFactory)testSet.TSTestFactory;
tsTestList = TSTestFactory.NewList("");
}
foreach (TSTest test in tsTestList)
{
System.Diagnostics.Debug.Writeln(test[qcFrameworkTestIDFieldName]);
}
}
else
{
Console.WriteLine("QC connection failed");
}
}
catch (Exception e)
{
throw e;
}
}
Notes:
All the best.
S