private static void CreateNewTestInstances(BusinessFlow businessFlow, ObservableList <ActivitiesGroup> existingActivitiesGroups, QCTestSet testSet, ObservableList <ExternalItemFieldBase> testInstancesFields) { int counter = 1; foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { if (existingActivitiesGroups.Contains(ag) == false && string.IsNullOrEmpty(ag.ExternalID) == false && ImportFromQCRest.GetQCTest(ag.ExternalID) != null) { QCTestInstance testInstance = new QCTestInstance { TestId = ag.ExternalID, CycleId = testSet.Id, TestOrder = counter++.ToString(), }; //set item fields for test instances foreach (ExternalItemFieldBase field in testInstancesFields) { if ((field.ToUpdate || field.Mandatory) && (!(field.ExternalID == "test-id") && !(field.ExternalID == "cycle-id"))) { if (string.IsNullOrEmpty(field.ExternalID) == false && field.SelectedValue != "NA") { testInstance.ElementsField[field.ExternalID] = field.SelectedValue; } else { try { testInstance.ElementsField[field.ID] = "NA"; } catch { } } } } testInstance.ElementsField["subtype-id"] = "hp.qc.test-instance.MANUAL"; QCItem item = ConvertObjectValuesToQCItem(testInstance, ResourceType.TEST_CYCLE); ALMResponseData response = QCRestAPIConnect.CreateNewEntity(ResourceType.TEST_CYCLE, item); if (response.IsSucceed) // # Currently bug in HPE failing the test instance creation despite it working. { //QCTestInstance testInstanceCreated = QCRestAPIConnect.QcRestClient.GetTestInstanceDetails(response.IdCreated); ag.ExternalID2 = response.IdCreated;//the test case instance ID in the test set- used for exporting the execution details } } } }
public QCTestCase GetQCTest(string testID) { return(ImportFromQCRest.GetQCTest(testID)); }