private void SetInitialGridsData() { mWizard.mappedTestCasesStepPageList.Clear(); foreach (ALMTestCaseManualMappingConfig mtc in mWizard.testCasesMappingList) { if (mtc.aLMTSTest is not null) { mWizard.mappedTestCasesStepPageList.Add(mtc); } } xMapTestCasesGrid.DataSourceList = mWizard.mappedTestCasesStepPageList; ALMTestCaseManualMappingConfig selectedTCConfig = (xMapTestCasesGrid.Grid.SelectedItem as ALMTestCaseManualMappingConfig); if (mWizard.mappedTestCasesStepPageList.Count > 0) { xMapTestStepsGrid.DataSourceList = selectedTCConfig.testStepsMappingList; foreach (ALMTestCaseManualMappingConfig tc in mWizard.mappedTestCasesStepPageList) { if (!mWizard.testCaseUnmappedStepsDic.ContainsKey(tc.aLMTSTest.TestID)) { mWizard.testCaseUnmappedStepsDic.Add(tc.aLMTSTest.TestID, new ObservableList <ALMTSTestStep>()); } tc.UpdateTestCaseMapStatus(mWizard.testCaseUnmappedStepsDic[tc.aLMTSTest.TestID].Count); } xUnMapTestStepsGrid.DataSourceList = mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID]; xMapTestCasesGrid.Title = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups, "Ginger", "& ALM Test Cases - Steps Mapping Status"); xMapTestStepsGrid.Title = GingerDicser.GetTermResValue(eTermResKey.Activities, $"Ginger ‘{mWizard.mappedTestCasesStepPageList[0].ActivityGroupName}’ ", "- ALM Steps Mapping"); xUnMapTestStepsGrid.Title = $"ALM ‘{mWizard.mappedTestCasesStepPageList[0].TestCaseName}’ Steps"; } }
/// <summary> /// 1. Remap testStepsMappingList. /// 2. Set testCaseUnmappedStepsDic. /// </summary> /// <param name="tc">Mapped Test Case</param> private void ReMapTestSteps(ALMTestCaseManualMappingConfig tc) { Dictionary <string, ALMTSTestStep> almStepsDic = new Dictionary <string, ALMTSTestStep>(); if (tc.aLMTSTest is not null) { foreach (ALMTSTestStep tStep in tc.aLMTSTest.Steps) { almStepsDic.Add(tStep.StepID, tStep); } } // Remap test steps foreach (ActivityIdentifiers act in tc.activitiesGroup.ActivitiesIdentifiers) { tc.testStepsMappingList.Add(new ALMTestStepManualMappingConfig() { activity = act }); if (!String.IsNullOrEmpty(act.ActivityExternalID)) { if (almStepsDic.ContainsKey(act.ActivityExternalID)) { tc.testStepsMappingList[tc.testStepsMappingList.Count - 1].almTestStep = almStepsDic[act.ActivityExternalID]; almStepsDic.Remove(act.ActivityExternalID); } } } // Set unmapped steps list after remove all mapped steps. testCaseUnmappedStepsDic.Add(tc.activitiesGroup.ExternalID, new ObservableList <ALMTSTestStep>()); foreach (ALMTSTestStep unmappedTStep in almStepsDic.Values) { testCaseUnmappedStepsDic[tc.activitiesGroup.ExternalID].Add(unmappedTStep); } }
/// <summary> /// Clear selected Test Case steps. /// </summary> /// <param name="manualTC"></param> internal void ClearStepsLists(ALMTestCaseManualMappingConfig manualTC) { if (manualTC.aLMTSTest is not null && testCaseUnmappedStepsDic.ContainsKey(manualTC.aLMTSTest.TestID)) { testCaseUnmappedStepsDic[manualTC.aLMTSTest.TestID].Clear(); testCaseUnmappedStepsDic.Remove(manualTC.aLMTSTest.TestID); } manualTC.testStepsMappingList.Clear(); mappedTestCasesStepPageList.Remove(manualTC); }
private void ReplaceMappedTestCaseHandler(ALMTestCaseManualMappingConfig source, ALMTestCaseManualMappingConfig target) { mWizard.ClearStepsLists(source); mWizard.ClearStepsLists(target); ALMTSTest targetTemp = target.aLMTSTest; // Map test case to Map row. target.UpdateMappedTestCase(source.aLMTSTest); // Replace target with source. source.UpdateMappedTestCase(targetTemp); }
private void UnMapTestCaseHandler(ALMTestCaseManualMappingConfig source) { if (source.aLMTSTest is null) { return; } mWizard.ClearStepsLists(source); // Add test case to unmapped list mWizard.testCasesUnMappedList.Add(source.aLMTSTest); // Remove test case from Map row. source.UpdateMappedTestCase(null); }
private void UpdateMapTestCasesData() { ALMTestCaseManualMappingConfig selectedTCConfig = (xMapTestCasesGrid.Grid.SelectedItem as ALMTestCaseManualMappingConfig); if (selectedTCConfig is not null && mWizard.testCaseUnmappedStepsDic.ContainsKey(selectedTCConfig.aLMTSTest.TestID)) { xMapTestStepsGrid.DataSourceList = selectedTCConfig.testStepsMappingList; xUnMapTestStepsGrid.DataSourceList = mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID]; selectedTCConfig.UpdateTestCaseMapStatus(mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Count); xMapTestStepsGrid.Title = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup, $"Ginger ‘{selectedTCConfig.ActivityGroupName}’"); xUnMapTestStepsGrid.Title = $"ALM ‘{selectedTCConfig.TestCaseName}’ Steps"; } }
private void MapTestCaseHandler(ALMTSTest source, ALMTestCaseManualMappingConfig target) { if (source is null) { return; } // if target already mapped, Add to unmapped list. if (target.aLMTSTest is not null) { mWizard.ClearStepsLists(target); mWizard.testCasesUnMappedList.Add(target.aLMTSTest); } // Map test case. target.UpdateMappedTestCase(source); // Remove test case from unmapped list. mWizard.testCasesUnMappedList.Remove(source); }
private void UnMapTestStepHandler(ALMTestStepManualMappingConfig source) { ALMTestCaseManualMappingConfig selectedTCConfig = (xMapTestCasesGrid.Grid.SelectedItem as ALMTestCaseManualMappingConfig); if (source.almTestStep is null || selectedTCConfig is null) { return; } // Add test step to unmapped list if (mWizard.testCaseUnmappedStepsDic.ContainsKey(selectedTCConfig.aLMTSTest.TestID)) { mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Add(source.almTestStep); // Remove test step from Map row. source.UpdateMappedTestStep(null); selectedTCConfig.UpdateTestCaseMapStatus(mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Count); } }
private void UnmapAllRows(object sender, RoutedEventArgs e) { try { ALMTestCaseManualMappingConfig selectedTCConfig = (xMapTestCasesGrid.Grid.SelectedItem as ALMTestCaseManualMappingConfig); if (selectedTCConfig is null) { return; } foreach (ALMTestStepManualMappingConfig ats in selectedTCConfig.testStepsMappingList) { UnMapTestStepHandler(ats); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.DEBUG, ex.Message); } }
// TODO add to helper functions private void MapTestStepHandler(ALMTSTestStep source, ALMTestStepManualMappingConfig target) { ALMTestCaseManualMappingConfig selectedTCConfig = (xMapTestCasesGrid.Grid.SelectedItem as ALMTestCaseManualMappingConfig); if (selectedTCConfig is null) { return; } if (mWizard.testCaseUnmappedStepsDic.ContainsKey(selectedTCConfig.aLMTSTest.TestID)) { // if target already mapped, Add to unmapped list. if (target.almTestStep is not null) { mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Add(target.almTestStep); } // Map test step. target.UpdateMappedTestStep(source); // Remove test step from unmapped list. mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Remove(source); selectedTCConfig.UpdateTestCaseMapStatus(mWizard.testCaseUnmappedStepsDic[selectedTCConfig.aLMTSTest.TestID].Count); } }