我正在尝试使用OTA API在QC中添加新缺陷。在创建缺陷时,我无法设置一些必填字段。下面是我的代码。我使用.NET framework 4.5和C#进行代码开发。
如果我评论了问题类型 //问题类型 // bug1 [" BG_USER_02"] ="缺陷&#34 ;; 它给出错误,因为必填字段不能为空或填充空格。;
另请告诉我常数(例如.BG_USER_02)值用于以下必填字段,即问题类型,产品,应用程序和模块是否正确如果这些不是正确的常数值,请建议我这些字段的常量值。
//Issue Type
bug1["BG_USER_02"] = "Defect";
//Product
bug1["BG_USER_07"] = "Product1";
//Application
bug1["BG_USER_08"] = "Application";
//Module
bug1["BG_USER_04"] = "Accounts";
string qcUrl = "http://localhost:XXXX/qcbin";
string qcDomain = "TestDomain";
string qcProject = "TestProject";
string qcLoginName = "user1";
string qcPassword = "user1";
TDConnection connection = new TDConnection();
connection.InitConnectionEx(qcUrl);
connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword);
BugFactory bugFact = connection.BugFactory;
Bug bug1 = bugFact.AddItem(System.DBNull.Value);
//Summery
bug1.Summary = "This is summary";
//Detected in Cycle
bug1["BG_DETECTED_IN_RCYC"] = @"Release\Program\Test\Value";
// Detected in Release
bug1["BG_DETECTED_IN_REL"] = @"Release\Program\Test\Value";
//Issue Type
bug1["BG_USER_02"] = "Defect";
//Product
bug1["BG_USER_07"] = "Product1";
//Application
bug1["BG_USER_08"] = "Application";
//Module
bug1["BG_USER_04"] = "Accounts";
//Priority
bug1.Priority = "P1 - High";
//Severity
bug1["BG_SEVERITY"] = "SEVERITY1";
//Lines of Business
bug1.Project = "Fire";
//Reproducible
bug1["BG_REPRODUCIBLE"] = "Y";
// Owner Name
bug1.AssignedTo = "XYZ";
//Status
bug1.Status = "New";
//Detected By
bug1.DetectedBy = "user1";
//Detected on Date
bug1["BG_DETECTION_DATE"] = "9/9/2016";
//Detected in Version
bug1["BG_DETECTION_VERSION"] = "8.1.0.11";
//Description
bug1["BG_DESCRIPTION"] = "Description";
bug1.Post();
MessageBox.Show("Post");
connection.DisconnectProject();
connection.Logout();
connection.ReleaseConnection();
由于 Amrapali Kamble