/// <summary> /// Creates a new test case under the specified automation provider. /// </summary> /// <param name="testCase">Rhino.Api.Contracts.AutomationProvider.RhinoTestCase by which to create automation provider test case.</param> /// <returns>The ID of the newly created entity.</returns> public override string CreateTestCase(RhinoTestCase testCase) { // constants: logging const string M = "Create-Test -Project [{0}] -Set [{1}] = true"; // create jira issue var issue = CreateTestOnJira(testCase); // apply to context testCase.Key = $"{issue["key"]}"; testCase.Context["jira-issue-id"] = issue == default ? string.Empty : $"{issue["id"]}"; // create test steps CreateTestSteps(testCase); // create & apply preconditions var precondition = CreatePrecondition(testCase.Key, testCase.DataSource); if (precondition != null) { xpandClient.AddPrecondition($"{precondition.SelectToken("id")}", testCase.Key); } // add to test sets var testSets = jiraClient .Get(idsOrKeys: testCase.TestSuites) .Select(i => (id: $"{i.SelectToken("id")}", key: $"{i.SelectToken("key")}")); Parallel.ForEach(testSets, options, testSet => xpandClient.AddTestsToSet(idAndKey: testSet, new[] { $"{issue.SelectToken("id")}" })); // comment var comment = Utilities.GetActionSignature(action: "created"); jiraClient.AddComment(idOrKey: issue["key"].ToString(), comment); // success Logger?.InfoFormat(M, Configuration.ConnectorConfiguration.Project, string.Join(", ", testCase?.TestSuites)); // results return($"{issue}"); }