/// <summary> /// Set XRay test execution results of test case by setting steps outcome. /// </summary> /// <param name="testCase">RhinoTestCase by which to update XRay results.</param> /// <returns>-1 if failed to update, 0 for success.</returns> /// <remarks>Must contain runtimeid field in the context.</remarks> public static void SetOutcomeBySteps(this RhinoTestCase testCase) { // get steps // add exceptions images - if exists or relevant if (testCase.Context.ContainsKey(ContextEntry.OrbitResponse)) { testCase.AddExceptionsScreenshot(); } // collect steps var steps = new List <object>(); foreach (var testStep in testCase.Steps) { steps.Add(testStep.GetUpdateRequest(outcome: $"{testCase.Context["outcome"]}")); } // setup var executor = new JiraCommandsExecutor(testCase.GetAuthentication()); var command = RavenCommandsRepository.UpdateTestRun( testRun: $"{testCase.Context["runtimeid"]}", data: new { Steps = steps }); // send executor.SendCommand(command); }
/// <summary> /// Updates test results comment. /// </summary> /// <param name="testCase">RhinoTestCase by which to update test results.</param> public static void UpdateResultComment(this RhinoTestCase testCase, string comment) { // setup var executor = new JiraCommandsExecutor(testCase.GetAuthentication()); var command = RavenCommandsRepository.UpdateTestRun( testRun: $"{testCase.Context["runtimeid"]}", data: new { Comment = comment }); // send executor.SendCommand(command); }
/// <summary> /// Set XRay test execution results of test case by setting steps outcome. /// </summary> /// <param name="testCase">RhinoTestCase by which to update XRay results.</param> /// <returns>-1 if failed to update, 0 for success.</returns> /// <remarks>Must contain runtimeid field in the context.</remarks> public static void SetOutcomeBySteps(this RhinoTestCase testCase) { // get steps var onTestCase = testCase.AggregateSteps(); onTestCase.Context.AddRange(testCase.Context, new[] { "aggregated" }); // collect steps var steps = new List <object>(); foreach (var testStep in onTestCase.Steps) { steps.Add(testStep.GetUpdateRequest(outcome: $"{onTestCase.Context["outcome"]}")); } // setup var executor = new JiraCommandsExecutor(onTestCase.GetAuthentication()); var command = RavenCommandsRepository.UpdateTestRun( testRun: $"{onTestCase.Context["runtimeid"]}", data: new { Steps = steps }); // send executor.SendCommand(command); }