public void RecordRunResult() { TestSetCommand tsCommand = new TestSetCommand(EntityCommand.verb.createtestset, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); tsCommand.AddDestinationPath("Root\\UnitTests"); tsCommand.AddTestSetName(DateTime.Now.ToString() + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); XDocument xml = XDocument.Parse(ExecuteCmd(tsCommand.CommandString)[0]); int TestSetId = int.Parse(GetElementValue(xml, "entityid")); tsCommand = new TestSetCommand(EntityCommand.verb.addtesttotestset, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); tsCommand.AddTestSetId(TestSetId); tsCommand.AddTestConfigId(1002); xml = XDocument.Parse(ExecuteCmd(tsCommand.CommandString)[0]); TestRunCommand trCommand = new TestRunCommand(EntityCommand.verb.recordrunresult, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); trCommand.AddTestSetId(TestSetId); trCommand.AddRunName("My Test"); trCommand.AddTestConfigId(1002); trCommand.AddTestStatus(ALMReportingBridge.ALMEntity.TestStatus.Passed); xml = XDocument.Parse(ExecuteCmd(trCommand.CommandString)[0]); Assert.AreEqual("RecordRunResult", GetElementValue(xml, "operation")); Assert.AreEqual("Success", GetElementValue(xml, "status")); Assert.AreNotEqual(0, GetElementValue(xml, "entityid")); }
public void AttachToRun() { TestSetCommand tsCommand = new TestSetCommand(EntityCommand.verb.createtestset, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); tsCommand.AddDestinationPath("Root\\UnitTests"); tsCommand.AddTestSetName(DateTime.Now.ToString() + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); XDocument xml = XDocument.Parse(ExecuteCmd(tsCommand.CommandString)[0]); int TestSetId = int.Parse(GetElementValue(xml, "entityid")); tsCommand = new TestSetCommand(EntityCommand.verb.addtesttotestset, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); tsCommand.AddTestSetId(TestSetId); tsCommand.AddTestConfigId(1002); xml = XDocument.Parse(ExecuteCmd(tsCommand.CommandString)[0]); TestRunCommand trCommand = new TestRunCommand(EntityCommand.verb.recordrunresult, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); trCommand.AddTestSetId(TestSetId); trCommand.AddRunName("My Test"); trCommand.AddTestConfigId(1002); trCommand.AddTestStatus(ALMReportingBridge.ALMEntity.TestStatus.Passed); xml = XDocument.Parse(ExecuteCmd(trCommand.CommandString)[0]); int RunId = int.Parse(GetElementValue(xml, "entityid")); trCommand = new TestRunCommand(EntityCommand.verb.attachtorun, ServerUrl, AdminUser, AdminPassword, AlmDomain, StandardProject); trCommand.AddRunId(RunId); trCommand.AddAttachmentPath(AttachmentPath); trCommand.AddAttachmentType(ALMReportingBridge.ALMEntity.AttachmentType.File); trCommand.AddAttachmentName("My super awesome attachment.txt"); trCommand.AddAttachmentDescription("this is a description for an attachment"); xml = XDocument.Parse(ExecuteCmd(trCommand.CommandString)[0]); Assert.AreEqual("AttachToRun", GetElementValue(xml, "operation")); Assert.AreEqual("Success", GetElementValue(xml, "status")); }