The code below shows how to update several properties of a defect in your project in QAComplete. The code uses the Bugs_Update
operation to update the defect’s status, resolution code and resolution description. The operation gets a defect by its ID and updates its properties with new values you specify. All unspecified properties are cleared.
You can update properties of items of other types (releases, tasks, requirements, and so on) the same way you update the defect’s properties. To do this, use the appropriate operation. For example, use the Releases_Update
operation to update the release’s properties, use the ProjectTasks_Update
operation to update the task’s properties and so on. For information on what operations you can use to update properties of a desired item in your project, see API Reference.
C#
string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;
// Specifying the bug to update
int ID = 43;
ServiceSoapClient service = new ServiceSoapClient();
// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;
// Loading existing defect data
Bug bug = service.Bugs_Load(authData, ID);
// Specifying new values of the defect properties
bug.StatusCode = "Resolved";
bug.ResolutionCode = "Fixed";
bug.Resolution = "Fixed in build 1.3.106";
// Updating the bug
service.Bugs_Update(authData, bug, "N");
Console.WriteLine("The defect was updated.");
Java
String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;
// Specifying the bug to update
int ID = 43;
ServiceSoap service = new Service().getServiceSoap12();
// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);
// Loading existing defect data
Bug bug = service.bugsLoad(authData, ID);
// Specifying new values of the defect properties
bug.setStatusCode("Resolved");
bug.setResolutionCode("Fixed");
bug.setResolution("Fixed in build 1.3.106");
// Updating the defect
service.bugsUpdate(authData, bug, "N");
System.out.println("The defect was updated.");