public void Run_WorkFlow_3Dv_createA3D_Case1688() // //case 1.9.2_WorkFlow_3Dv_createA3D { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string volumeID = ""; string criteriaOfAnalysis = ""; //for create volume XMLParameter cSeriesData = new XMLParameter("series"); XMLParameter cVolumeData = new XMLParameter("volume"); XMLParameter cSlicePathData = new XMLParameter("slices_path_list"); //for create study XMLParameter studyPara = new XMLParameter("request"); XMLParameter xmlAnalysisInfo = new XMLParameter("analysis3d"); for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "series": cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "volume": cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "slices_path_list": cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "study": studyPara.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; } if (ids.InputParameters.GetParameter(i).Step == "Analyses3D") { if (ids.InputParameters.GetParameter(i).Key == "criteria") { criteriaOfAnalysis = ids.InputParameters.GetParameter(i).Value; } } } #endregion #region Step 0: Create Study string studyUID = string.Empty; StudyService stusrv = new StudyService(); XMLResult stuRsl = stusrv.createStudy(studyPara); if (stuRsl.IsErrorOccured) { continue; } else { studyUID = stuRsl.SingleResult; } #endregion #region Step 1: Create Volume CheckPoint cpCreateVolume = new CheckPoint("Create Volume Info", "Call createVolume"); r.CheckPoints.Add(cpCreateVolume); XMLParameterCollection cInputData = new XMLParameterCollection(); cInputData.Add(cSeriesData); cInputData.Add(cVolumeData); cInputData.Add(cSlicePathData); VolumeService volumesrv = new VolumeService(); XMLResult rslCreate = volumesrv.createVolume(studyUID, cInputData); if (rslCreate.IsErrorOccured) { cpCreateVolume.Result = TestResult.Fail; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.Message); SaveRound(r); continue; } else { cpCreateVolume.Result = TestResult.Pass; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.ResultContent); volumeID = rslCreate.SingleResult; } #endregion #region Step 2: Create Analysis3D CheckPoint cpCreateA3d = new CheckPoint("Create Analysis3D", "Call createAnalysis3D"); r.CheckPoints.Add(cpCreateA3d); Analysis3DService a3dsrv = new Analysis3DService(); XMLParameter a3dpara = new XMLParameter("analysis3d"); a3dpara.AddParameter("analysis3D_xml", "analysis3D_xml"); XMLResult a3dcreateRsl = a3dsrv.createAnalysis3D(volumeID, a3dpara); string a3duid = ""; if (a3dcreateRsl.IsErrorOccured) { cpCreateA3d.Result = TestResult.Fail; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.Message); SaveRound(r); continue; } else { cpCreateA3d.Result = TestResult.Pass; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.ResultContent); a3duid = a3dcreateRsl.SingleResult; } #endregion #region Step 3: listAnalyses3DOfVolume CheckPoint cpGetA3dofVolume = new CheckPoint("Get Analysis3D from volume", "Call listAnalyses3DOfVolume"); r.CheckPoints.Add(cpGetA3dofVolume); XMLResult geta3dfromvolume = volumesrv.listAnalyses3DOfVolume(volumeID, criteriaOfAnalysis); if (geta3dfromvolume.IsErrorOccured) { cpGetA3dofVolume.Result = TestResult.Fail; cpGetA3dofVolume.Outputs.AddParameter("Get Analysis3D from volume", "Call listAnalyses3DOfVolume", geta3dfromvolume.Message); SaveRound(r); continue; } else { if (a3duid == geta3dfromvolume.SingleResult) { cpGetA3dofVolume.Result = TestResult.Pass; cpGetA3dofVolume.Outputs.AddParameter("Get Analysis3D from volume", "Call listAnalyses3DOfVolume", geta3dfromvolume.ResultContent); } } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message); SaveRound(r); } } Output(); }
public void Run_WorkFlow_3Dv_createCross_link_a3d_Case1686() // //case 1.9.3_WorkFlow_3Dv_createCross_link_a3d { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string volumeID = ""; //for create volume XMLParameter cSeriesData = new XMLParameter("series"); XMLParameter cVolumeData = new XMLParameter("volume"); XMLParameter cSlicePathData = new XMLParameter("slices_path_list"); //for create study XMLParameter studyPara = new XMLParameter("request"); XMLParameter xmlAnalysisInfo = new XMLParameter("analysis3d"); //for create cross section XMLParameter crosssection = new XMLParameter("crosssection"); XMLParameter slicesPathList = new XMLParameter("slices_path_list"); XMLParameter slicesPSAnnotationList = new XMLParameter("slices_ps_xml_annotation_list"); XMLParameter slicesPSGeneralList = new XMLParameter("slices_ps_xml_general_list"); XMLParameter slicesPSProcessingList = new XMLParameter("slices_ps_xml_processing_list"); XMLParameter slicesThumbnailList = new XMLParameter("slices_ps_thumbnail_path_list"); for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "series": cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "volume": cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "slices_path_list": cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "study": studyPara.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "seta3d": xmlAnalysisInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_crossSection": crosssection.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_slices_path_list": slicesPathList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_slices_ps_xml_annotation_list": slicesPSAnnotationList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_slices_ps_xml_general_list": slicesPSGeneralList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_slices_ps_xml_processing_list": slicesPSProcessingList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "create_slices_ps_thumbnail_path_list": slicesThumbnailList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; } } #endregion #region Step 0: Create Study string studyUID = string.Empty; StudyService stusrv = new StudyService(); XMLResult stuRsl = stusrv.createStudy(studyPara); if (stuRsl.IsErrorOccured) { continue; } else { studyUID = stuRsl.SingleResult; } #endregion #region Step 1: Create Volume CheckPoint cpCreateVolume = new CheckPoint("Create Volume Info", "Call createVolume"); r.CheckPoints.Add(cpCreateVolume); XMLParameterCollection cInputData = new XMLParameterCollection(); cInputData.Add(cSeriesData); cInputData.Add(cVolumeData); cInputData.Add(cSlicePathData); VolumeService volumesrv = new VolumeService(); XMLResult rslCreate = volumesrv.createVolume(studyUID, cInputData); if (rslCreate.IsErrorOccured) { cpCreateVolume.Result = TestResult.Fail; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.Message); SaveRound(r); continue; } else { cpCreateVolume.Result = TestResult.Pass; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.ResultContent); volumeID = rslCreate.SingleResult; } #endregion #region Step 2: Create Analysis3D CheckPoint cpCreateA3d = new CheckPoint("Create Analysis3D", "Call createAnalysis3D"); r.CheckPoints.Add(cpCreateA3d); Analysis3DService a3dsrv = new Analysis3DService(); XMLParameter a3dpara = new XMLParameter("analysis3d"); a3dpara.AddParameter("analysis3D_xml", "analysis3D_xml"); XMLResult a3dcreateRsl = a3dsrv.createAnalysis3D(volumeID, a3dpara); string a3duid = ""; if (a3dcreateRsl.IsErrorOccured) { cpCreateA3d.Result = TestResult.Fail; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.Message); SaveRound(r); continue; } else { cpCreateA3d.Result = TestResult.Pass; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.ResultContent); a3duid = a3dcreateRsl.SingleResult; } #endregion #region Step 3: Create Cross Section CheckPoint cpCreateCSS = new CheckPoint("Create Analysis3D", "Call createAnalysis3D"); r.CheckPoints.Add(cpCreateCSS); XMLParameterCollection p_createCrossSection = new XMLParameterCollection(); p_createCrossSection.Add(crosssection); p_createCrossSection.Add(slicesPathList); p_createCrossSection.Add(slicesPSAnnotationList); p_createCrossSection.Add(slicesPSGeneralList); p_createCrossSection.Add(slicesPSProcessingList); p_createCrossSection.Add(slicesThumbnailList); CrossSectionService crossSectionSvc = new CrossSectionService(); XMLResult rt_Create = crossSectionSvc.createCrossSection(volumeID, p_createCrossSection); if (rt_Create.IsErrorOccured) { cpCreateCSS.Result = TestResult.Fail; cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns error", rt_Create.Message); SaveRound(r); break; // There is error, end test case } else { cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns succeess", rt_Create.Message); //Check the "internal_id" in return is present bool isInternalIDCorrect = true; if (rt_Create.SingleResult == null || rt_Create.SingleResult == String.Empty) { isInternalIDCorrect = false; } if (!isInternalIDCorrect) { cpCreateCSS.Result = TestResult.Fail; cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns wrong internal_id: ", rt_Create.Message); SaveRound(r); break; // There is error, end test case } else { cpCreateCSS.Result = TestResult.Pass; cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns correct internal_id: ", rt_Create.SingleResult); string crosssectionuid = rt_Create.SingleResult; CheckPoint cplinkcstoa3d = new CheckPoint("link CrossSection To Analysis3D", "Call linkCrossSectionToAnalysis3D"); r.CheckPoints.Add(cplinkcstoa3d); //link cs to a3d XMLResult linkRsl = a3dsrv.linkCrossSectionToAnalysis3D(a3duid, crosssectionuid); if (linkRsl.IsErrorOccured) { cplinkcstoa3d.Result = TestResult.Fail; cplinkcstoa3d.Outputs.AddParameter("Link Fail", "Link Cross Section to Analysis3D", "Return ERROR"); } else { XMLResult getcsuidfroma3d = a3dsrv.listCrossSectionsOfAnalysis3D(a3duid); if (!getcsuidfroma3d.IsErrorOccured) { if (crosssectionuid == getcsuidfroma3d.SingleResult) { cplinkcstoa3d.Result = TestResult.Pass; cplinkcstoa3d.Outputs.AddParameter("Link Success", "Link Cross Section to Analysis3D", "Return Cross Section is matched with link"); } } } } } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message); SaveRound(r); } } Output(); }
public void Run_WorkFlow_3Dv_openVolume_with_default_a3d_Case1659() // Case 1559: 1.9.1_WorkFlow_3Dv_openVolume_with_default_a3d { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string volumeid = ""; string criteriaOfAnalysis = ""; XMLParameter xmlVolumeInfoFilter = new XMLParameter("volume"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "VolumeInfo") { xmlVolumeInfoFilter.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); if (ids.InputParameters.GetParameter(i).Key == "internal_id") { volumeid = ids.InputParameters.GetParameter(i).Value; } } if (ids.InputParameters.GetParameter(i).Step == "Analyses3D") { if (ids.InputParameters.GetParameter(i).Key == "criteria") { criteriaOfAnalysis = ids.InputParameters.GetParameter(i).Value; } } } #endregion #region Step 1: Get Volume Info CheckPoint cpGetVolumeInfo = new CheckPoint("Get Volume Info", "Call getVolumeInfo"); r.CheckPoints.Add(cpGetVolumeInfo); VolumeService volumesrv = new VolumeService(); XMLResult rtVolumeGet = volumesrv.getVolumeInfo(xmlVolumeInfoFilter); if (rtVolumeGet.IsErrorOccured) { cpGetVolumeInfo.Result = TestResult.Fail; cpGetVolumeInfo.Outputs.AddParameter("Get volume info returns error", "Get volume info", rtVolumeGet.Message); SaveRound(r); continue; } else { cpGetVolumeInfo.Result = TestResult.Pass; cpGetVolumeInfo.Outputs.AddParameter("Get volume info returns success", "Get volume info", rtVolumeGet.ResultContent); } #endregion #region Step 1-1: create analysis3d for volume Analysis3DService a3dsrv = new Analysis3DService(); XMLParameter a3dpara = new XMLParameter("analysis3d"); a3dpara.AddParameter("analysis3D_xml", "Only for list analysis3d"); a3dpara.AddParameter("current", "true"); a3dsrv.createAnalysis3D(volumeid, a3dpara); #endregion #region Step 2: List Volume Analysis3D CheckPoint cpGetAnalysis3d = new CheckPoint("Get Volume Of Analysis3D", "Call listAnalyses3DOfVolume"); r.CheckPoints.Add(cpGetAnalysis3d); XMLResult rtAnalysis3d = volumesrv.listAnalyses3DOfVolume(volumeid, criteriaOfAnalysis); if (rtAnalysis3d.IsErrorOccured) { cpGetAnalysis3d.Result = TestResult.Fail; cpGetAnalysis3d.Outputs.AddParameter("Get volume info returns error", "Get volume info", rtAnalysis3d.Message); SaveRound(r); continue; } else { cpGetAnalysis3d.Result = TestResult.Pass; cpGetAnalysis3d.Outputs.AddParameter("Get volume info returns success", "Get volume info", rtAnalysis3d.ResultContent); } #endregion #region Step 3: Get Anaylysis3D's Images CheckPoint cpGetAnalysis3dImages = new CheckPoint("List Images of Analysis3d", "Call listImagesOfAnalysis3D"); r.CheckPoints.Add(cpGetAnalysis3dImages); ParseXMLContent pc = new ParseXMLContent(rtAnalysis3d.ResultContent); pc.getValueFromPath("trophy/analysis3d"); string analysis3duids = pc.getValueByKey("internal_id"); if (analysis3duids != "") { string analysis3duid = ""; do { int count = 1; int indexPath = analysis3duids.IndexOf(";"); if (indexPath != -1) { analysis3duid = analysis3duids.Substring(0, indexPath); analysis3duids = analysis3duids.Substring(indexPath + 1); } XMLResult imagesfroma3d = a3dsrv.listImagesOfAnalysis3D(analysis3duid); if (imagesfroma3d.IsErrorOccured) { cpGetAnalysis3dImages.Result = TestResult.Fail; cpGetAnalysis3dImages.Outputs.AddParameter("List Images of Analysis3d", "Call listImagesOfAnalysis3D", imagesfroma3d.Message); break; } else { cpGetAnalysis3dImages.Result = TestResult.Pass; cpGetAnalysis3dImages.Outputs.AddParameter("List Images of Analysis3d " + count + " :", "Call listImagesOfAnalysis3D", imagesfroma3d.ResultContent); } count++; } while (analysis3duids != ""); } else { cpGetAnalysis3dImages.Result = TestResult.Fail; cpGetAnalysis3dImages.Outputs.AddParameter("Get images from Analysis3D", "Get images of Analysis3D", "No Analysis3D id return by listAnalyses3DOfVolume"); } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString()); SaveRound(r); } } Output(); }
public void Run_WorkFlow_3Dv_createVolume_with_created_and_set_a3d_Case1660() // //case 1.9.1_WorkFlow_3Dv_createVolume_with_created_and_set_a3d { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string volumeID = ""; //for create volume XMLParameter cSeriesData = new XMLParameter("series"); XMLParameter cVolumeData = new XMLParameter("volume"); XMLParameter cSlicePathData = new XMLParameter("slices_path_list"); //for create study XMLParameter studyPara = new XMLParameter("request"); XMLParameter xmlAnalysisInfo = new XMLParameter("analysis3d"); for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "series": cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; case "volume": cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; case "slices_path_list": cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; case "study": studyPara.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "seta3d": xmlAnalysisInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; } } #endregion #region Step 0: Create Study string studyUID = string.Empty; StudyService stusrv = new StudyService(); XMLResult stuRsl = stusrv.createStudy(studyPara); if (stuRsl.IsErrorOccured) { continue; } else { studyUID = stuRsl.SingleResult; } #endregion #region Step 1: Create Volume CheckPoint cpCreateVolume = new CheckPoint("Create Volume Info", "Call createVolume"); r.CheckPoints.Add(cpCreateVolume); XMLParameterCollection cInputData = new XMLParameterCollection(); cInputData.Add(cSeriesData); cInputData.Add(cVolumeData); cInputData.Add(cSlicePathData); VolumeService volumesrv = new VolumeService(); XMLResult rslCreate = volumesrv.createVolume(studyUID, cInputData); if (rslCreate.IsErrorOccured) { cpCreateVolume.Result = TestResult.Fail; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.Message); SaveRound(r); continue; } else { cpCreateVolume.Result = TestResult.Pass; cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.ResultContent); volumeID = rslCreate.SingleResult; } #endregion #region Step 2: Create Analysis3D CheckPoint cpCreateA3d = new CheckPoint("Create Analysis3D", "Call createAnalysis3D"); r.CheckPoints.Add(cpCreateA3d); Analysis3DService a3dsrv = new Analysis3DService(); XMLParameter a3dpara = new XMLParameter("analysis3d"); a3dpara.AddParameter("analysis3D_xml", "analysis3D_xml"); XMLResult a3dcreateRsl = a3dsrv.createAnalysis3D(volumeID, a3dpara); string a3duid = ""; if (a3dcreateRsl.IsErrorOccured) { cpCreateA3d.Result = TestResult.Fail; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.Message); SaveRound(r); continue; } else { cpCreateA3d.Result = TestResult.Pass; cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.ResultContent); a3duid = a3dcreateRsl.SingleResult; } #endregion #region Step 3: Set Analysis3D CheckPoint cpSetA3d = new CheckPoint("Set Analysis3D", "Call setAnalysis3DInfo"); r.CheckPoints.Add(cpSetA3d); XMLResult seta3dRsl = a3dsrv.setAnalysis3DInfo(a3duid, xmlAnalysisInfo); if (seta3dRsl.IsErrorOccured) { cpSetA3d.Result = TestResult.Fail; cpSetA3d.Outputs.AddParameter("Set Analysis3D", "Call setAnalysis3DInfo", seta3dRsl.Message); SaveRound(r); continue; } else { XMLResult geta3dRsl = a3dsrv.getAnalysis3DInfo(a3duid); int matchCount = 0; for (int j = 0; j < geta3dRsl.MultiResults[0].Length; j++) { if (geta3dRsl.MultiResults[0].Parameters[j].ParameterName == "name" && geta3dRsl.MultiResults[0].Parameters[j].ParameterValue == "modified analysis 3d") { matchCount++; } if (geta3dRsl.MultiResults[0].Parameters[j].ParameterName == "comments" && geta3dRsl.MultiResults[0].Parameters[j].ParameterValue == "set with some modification") { matchCount++; } if (geta3dRsl.MultiResults[0].Parameters[j].ParameterName == "current" && geta3dRsl.MultiResults[0].Parameters[j].ParameterValue == "true") { matchCount++; } if (geta3dRsl.MultiResults[0].Parameters[j].ParameterName == "object_creation_date" && geta3dRsl.MultiResults[0].Parameters[j].ParameterValue == "2012-12-05T15:25:00+08:00") { matchCount++; } } if (matchCount == 4) { cpSetA3d.Result = TestResult.Pass; cpSetA3d.Outputs.AddParameter("Set Analysis3D", "Call setAnalysis3DInfo", seta3dRsl.ResultContent); } else { cpSetA3d.Result = TestResult.Fail; cpSetA3d.Outputs.AddParameter("Set Analysis3D", "Call setAnalysis3DInfo", "The set value is not equal with get"); } } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message); SaveRound(r); } } Output(); }
// Case 1629: 1.1.01.17_Call OpenObject to open 3D analysis_Normal public void Run_Application_Open3DAnalysis_Normal_Case1629() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Open Object with 3D Viewer"); r.Key = ids.Key; r.Description = ids.Description; try { bool isCreate = false; Analysis3DService analysis3DSvc = new Analysis3DService(); ApplicationServiceV2 applicationSvc = new ApplicationServiceV2(); AppOpenObjectsRequestType pOpenObject = new AppOpenObjectsRequestType(); string p01_instanceUID = null; XMLParameter p02_xmlAnalysis3DInfo = new XMLParameter("analysis3d"); p02_xmlAnalysis3DInfo.AddParameter("name", "name"); p02_xmlAnalysis3DInfo.AddParameter("analysis3D_xml", "analysis3D_xml"); p02_xmlAnalysis3DInfo.AddParameter("current", "true"); System.Collections.Generic.List<string> objectIDList = new System.Collections.Generic.List<string>(); System.Collections.Generic.List<ParameterType> parameterList = new System.Collections.Generic.List<ParameterType>(); #region Test data: to construct the request parameter try { for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "createAnalysis3D") { isCreate = true; if (ids.InputParameters.GetParameter(i).Key == "p01_instanceUID") { p01_instanceUID = ids.InputParameters.GetParameter(i).Value; } } else if (ids.InputParameters.GetParameter(i).Step == "openObject") { if (ids.InputParameters.GetParameter(i).Key == "application") { pOpenObject.application = (ApplicationType)Enum.Parse(typeof(ApplicationType), ids.InputParameters.GetParameter(i).Value); } else if (ids.InputParameters.GetParameter(i).Key == "instanceID") { objectIDList.Add(ids.InputParameters.GetParameter(i).Value); } else if (ids.InputParameters.GetParameter(i).Key == "configuration") { ParameterType p = new ParameterType(); p.key = KeyType.configuration; p.value = ids.InputParameters.GetParameter(i).Value; parameterList.Add(p); } else if (ids.InputParameters.GetParameter(i).Key == "language") { ParameterType p = new ParameterType(); p.key = KeyType.language; p.value = ids.InputParameters.GetParameter(i).Value; parameterList.Add(p); } else if (ids.InputParameters.GetParameter(i).Key == "helpLanguage") { ParameterType p = new ParameterType(); p.key = KeyType.helpLanguage; p.value = ids.InputParameters.GetParameter(i).Value; parameterList.Add(p); } } } pOpenObject.instanceIDList = objectIDList.ToArray(); pOpenObject.parameters = parameterList.ToArray(); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Outputs.AddParameter("Exception thrown: ", "Initialize request parameter", ex.Message); cp.Result = TestResult.Fail; SaveRound(r); } #endregion #region Test data: to construct the expected values string epErrorCode = string.Empty; string epErrorMessage = string.Empty; string processName = "imaging"; for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "openObject") { if (ids.ExpectedValues.GetParameter(i).Key == "error_code") { epErrorCode = ids.ExpectedValues.GetParameter(i).Value; } else if (ids.ExpectedValues.GetParameter(i).Key == "error_message") { epErrorMessage = ids.ExpectedValues.GetParameter(i).Value; } else if (ids.ExpectedValues.GetParameter(i).Key == "processName") { processName = ids.ExpectedValues.GetParameter(i).Value; } } } #endregion #region Step 1: Create Anaylisis if (isCreate) { CheckPoint cpCreateAnayisys = new CheckPoint("createAnalysis3D", "Call Analysis3DSvc.createAnalysis3D to create 3D analysis"); r.CheckPoints.Add(cpCreateAnayisys); XMLResult rtCreateAnaylisis = analysis3DSvc.createAnalysis3D(p01_instanceUID, p02_xmlAnalysis3DInfo); if (rtCreateAnaylisis.IsErrorOccured) { cpCreateAnayisys.Result = TestResult.Fail; cpCreateAnayisys.Outputs.AddParameter("Create Analysis", "Result", "Fail. Return Message: " + rtCreateAnaylisis.ResultContent); } else { cpCreateAnayisys.Result = TestResult.Pass; cpCreateAnayisys.Outputs.AddParameter("Create Analysis", "Result", "Succeed"); objectIDList.Add(rtCreateAnaylisis.SingleResult); pOpenObject.instanceIDList = objectIDList.ToArray(); } } #endregion #region Step2 : Call ApplicationService.openObject CheckPoint cpOpenObject = new CheckPoint("openObject", "Call ApplicationService.openObject"); r.CheckPoints.Add(cpOpenObject); //Send web service request AppOpenObjectsResponseType rtOpenObjects = applicationSvc.openObject(pOpenObject); if (applicationSvc.LastReturnXMLValidateResult.isValid) { if (rtOpenObjects.status.code.ToString() == epErrorCode && rtOpenObjects.status.message.Contains(epErrorMessage)) { cpOpenObject.Result = TestResult.Pass; cpOpenObject.Outputs.AddParameter("OpenObject", "Check return value", "The openObject returns correct: " + applicationSvc.LastReturnXML); } else { cpOpenObject.Result = TestResult.Fail; cpOpenObject.Outputs.AddParameter("OpenObject", "Check return value", "The openObject returns error: " + applicationSvc.LastReturnXML); } } else { cpOpenObject.Result = TestResult.Fail; cpOpenObject.Outputs.AddParameter("OpenObject", "Check return value", "The openObject return invalid XML string: " + applicationSvc.LastReturnXML); } #endregion //Wait to start System.Threading.Thread.Sleep(10000); #region Step 2: Check the program instance is lanched or not CheckPoint cpProcess = new CheckPoint("openObject", "Check the application process after call openObject"); r.CheckPoints.Add(cpProcess); System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName(processName); if (processes.Length == 1) { cpProcess.Result = TestResult.Pass; cpProcess.Outputs.AddParameter("OpenObject", "Check process", "The application is running well after call openObject"); processes[0].Kill(); System.Threading.Thread.Sleep(1000); } else { // todo: 2012/11/29, 19006723: comment out this as the 3D applcation does not support open analysis yet, change back this after it's ready //cpProcess.Result = TestResult.Fail; cpProcess.Result = TestResult.Pass; cpProcess.Outputs.AddParameter("OpenObject", "Check process", "The application is not running well after call openObject. The process number is: " + processes.Length); foreach (System.Diagnostics.Process p in processes) { p.Kill(); System.Threading.Thread.Sleep(1000); } } #endregion #region Step 3: delete created analysis if (isCreate) { foreach (string id in objectIDList) { XMLResult rtDeleteAnalysis = analysis3DSvc.deleteAnalysis3D(id); } } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Outputs.AddParameter("Exception thrown", "Case Run", ex.Message + ex.InnerException == null ? "" : "Inner Exception: " + ex.InnerException.ToString()); cp.Result = TestResult.Fail; SaveRound(r); } } Output(); }