Automatically add requirements to Quality Center using C#

This is my new project at work. I have to take requirements from an InfoPath document and export them to QC11 (ALM). There are a lot of documentation for VB but not much for C# (which is why I am posting this). There are two parts to this process. First i’ll have to extract data from the InfoPath document and then connect to QC and add the requirements. I’ll post the XML part later. For now, Here’s how you can connect to QC and add a dummy requirement using C#.


//Declare an object of TDCoonection
TDConnection qctd = new TDConnection();
//Pass the QC server URL
qctd.InitConnectionEx("http://yourserver:port/qcbin");
//Connect with the QC
qctd.ConnectProjectEx("domain name", "project name", "userid", "password");
bool check = qctd.LoggedIn;

ReqFactory myReqFactory = (ReqFactory)qctd.ReqFactory;
Req myReq = (Req)myReqFactory.AddItem(DBNull.Value);
myReq.Name = "new requirement";
// 0=Business, 1=Folder, 2=Functional, 3=group, 4=testing
myReq.TypeId = "1";
myReq.ParentId = 0;
myReq.Post();

Advertisement
This entry was posted in C#, QC, Uncategorized. Bookmark the permalink.

One Response to Automatically add requirements to Quality Center using C#

  1. vinay says:

    Thanks yar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s