public SaveTestRunResponse RegisterTestRunFinish(long testRunId, FinishTestRunRequest requestBody)
        {
            var request = new RestRequest(Reporting($"/v1/test-runs/{testRunId}"), DataFormat.Json);

            request.AddJsonBody(requestBody);

            var response = _restClient.Put <SaveTestRunResponse>(request);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                return(response.Data);
            }

            throw new Exception($"Could not register finish of test run. Response body is {response.Content}");
        }
예제 #2
0
        public void RegisterTestRunFinish()
        {
            var testRun = RunContext.GetCurrentTestRun();

            if (testRun != null)
            {
                Log($"({testRun.Id}) Registering test run finish...");
                var finishTestRunRequest = new FinishTestRunRequest
                {
                    EndedAt = DateTime.UtcNow
                };
                var saveTestRunResponse = _apiClient.RegisterTestRunFinish(testRun.Id, finishTestRunRequest);
                RunContext.SetCurrentTestRun(saveTestRunResponse);

                Log($"({testRun.Id}) Test run finish was registered successfully.");
            }
        }