/// <summary> /// Utility_s the delete patient for specific case. /// </summary> /// <param name="patientID">The patient ID.</param> /// <returns>The Web Service Call return</returns> public static XMLResult Utility_DeletePatientForSpecificCase(string patientID) { PatientService ps = new PatientService(); XMLResult result = ps.deletePatient(patientID); return(result); }
public static string AcquireImage(XMLParameter acq) { string psid = string.Empty; AcquisitionService acqs = new AcquisitionService(); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(1000); if (!rslAcqRVG.IsErrorOccured) { XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { // 2012-11-27/19006723: Change as the getAcquisitionResult return XML changes in Sprint 7 //int i = 0; //for (i = 0; i < getAcqRVG.MultiResults[0].Parameters.Count; i++) //{ // if (getAcqRVG.MultiResults[0].Parameters[i].ParameterName == "presentation_state_internal_id") // { // psid = getAcqRVG.MultiResults[0].Parameters[i].ParameterValue; // break; // } //} //break; PAS.AutoTest.TestUtility.ParseXMLContent parser = new PAS.AutoTest.TestUtility.ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (psIDs.Length >= 1) { psid = psIDs[0]; break; } } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) { continue; } if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { break; } } while (true); } return(psid); }
/// <summary> /// Utility_s the create patient for specific case. /// </summary> /// <param name="caseID">The case ID.</param> /// <returns>The patien ID</returns> public static string Utility_CreatePatientForSpecificCase(string caseID) { string patientUID = null; PatientService ps = new PatientService(); XMLParameter pa = new XMLParameter("patient"); pa.AddParameter("first_name", caseID); pa.AddParameter("last_name", caseID); pa.AddParameter("middle_name", caseID); XMLResult result = ps.createPatient(pa); if (!result.IsErrorOccured) { patientUID = result.SingleResult; } return(patientUID); }
//Case 1016: 1.3.17_workflow_PostImportWithStompNotification public void Run_WorkFlow_PostImportWithStompNotification_Case1016() { int runCount = 0; // this is the initial run count. Use this count to repeat different test data set. //Generic notification to used to stop the notification receiver string stopMessageType = "Stop Receiving the Notification"; string stopMessageContent = "Stop Receiving the Notification"; // Stepup the notification receiver NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification(); //NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification("10.112.39.167"); System.Collections.Generic.List<string> rms = new System.Collections.Generic.List<string>(); rms.Add("topic.patientCreated"); rms.Add("topic.postImportStarted"); rms.Add("topic.postImportCompleted"); rms.Add("topic.fmsCreated"); rms.Add("topic.imageCreated"); rms.Add("topic.simpleInstanceCreated"); rms.Add("topic.presentationStateInfoModified"); rn.startListon(rms, stopMessageType, stopMessageContent); foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Test round"); //Mark the check point here to indicate what's the check point here CheckPoint p1 = new CheckPoint("createPatient", "Setup environment of createPatient"); CheckPoint p2 = new CheckPoint("initListObjects", "First result of listObjects for the postImport"); CheckPoint p3 = new CheckPoint("endListObjects", "End result of listObjects for the postImport"); CheckPoint p4 = new CheckPoint("stompNotification", "Number of received stomp notification during postImport"); r.CheckPoints.Add(p1); r.CheckPoints.Add(p2); r.CheckPoints.Add(p3); r.CheckPoints.Add(p4); //create required PAS service instaces here PatientService pats = new PatientService(); ApplicationService ass = new ApplicationService(); //create input parameters here, it may include XML path type and string type value XMLParameter pa1 = new XMLParameter("createPatient"); XMLParameter pa2 = new XMLParameter("listObjects"); for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "createPatient": pa1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "listObjects": pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; default: Console.WriteLine("There is no valid selection when parse input parameters."); break; } } //If we need change parameter by specific logic, please put code here //Get service result //Step1 result XMLResult step1_result = pats.createPatient(pa1); //Log step1 service output if (step1_result.IsErrorOccured) { p1.Result = TestResult.Fail; p1.Outputs.AddParameter("createPatient", "Error", step1_result.ResultContent); SaveRound(r); continue; } p1.Result = TestResult.Pass; p1.Outputs.AddParameter("createPatient", "Success", step1_result.ResultContent); //Change input parameter according the output of Step1 pa2.AddParameter("patient_internal_id", step1_result.SingleResult); //Step2 result XMLResult step2_result = pats.listObjects(pa2); //Log step2 service output if (step2_result.Code != 800) { p2.Result = TestResult.Fail; p2.Outputs.AddParameter("initListObjects", "Error", step2_result.ResultContent); SaveRound(r); continue; } p2.Result = TestResult.Pass; p2.Outputs.AddParameter("initListObjects", "Success", step2_result.ResultContent); //Change input parameter according the output of Step2 //Step3 result XMLResult step3_result = new XMLResult(); int countOfListObjectsLoop = 0; do { System.Threading.Thread.Sleep(30000); countOfListObjectsLoop++; step3_result = pats.listObjects(pa2); //Log step3 service output if (step3_result.Code == 0) { p3.Result = TestResult.Pass; p3.Outputs.AddParameter("endListObjects", "Success", step3_result.ResultContent); break; } if (step3_result.IsErrorOccured && countOfListObjectsLoop > 2) { p3.Result = TestResult.Fail; p3.Outputs.AddParameter("endListObjects", "Error", step3_result.ResultContent); SaveRound(r); break; } } while (true); //Change input parameter according the output of Step3 //Step4 result System.Threading.Thread.Sleep(500); ass.sendGenericNotification(stopMessageType, stopMessageContent); System.Threading.Thread.Sleep(1000); int step4_result = rn.getNotificationNumber() - 1; //Log step4 service output if (ids.ExpectedValues.GetParameter("NumOfNotification").Value == step4_result.ToString()) { p4.Result = TestResult.Pass; foreach (string notification in rn.getNotificationContent()) { p4.Outputs.AddParameter("Received notification number and content: " + rn.getNotificationContent().IndexOf(notification), "Success", notification); } } else { p4.Result = TestResult.Fail; p4.Outputs.AddParameter("Received notification number", "Error", step4_result.ToString()); foreach (string notification in rn.getNotificationContent()) { p4.Outputs.AddParameter("Received notification number and content: " + rn.getNotificationContent().IndexOf(notification), "Error", notification); } } //Save data for each round SaveRound(r); } //Save service log as xml file Output(); }
//Case 230: 1.3.8_ListFMSPresentationState_Normal public void Run_FMS_ListFMSPresentationState_Normal_Case230() { /** Using service: AcquisitionService,FMSService * Using interface: * AcquisitionService::startAcquisition * AcquisitionService::getAcquisitionResult * FMSService::listFMSPresentationState * FMSService::deleteFMS **/ int runCount = 0; string acquireType = string.Empty; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); AcquisitionService acqs = new AcquisitionService(); FMSService fmss = new FMSService(); XMLParameter acq = new XMLParameter("acq_info"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "acquireType") { acquireType = ids.InputParameters.GetParameter(i).Key; } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition FMS"); r.CheckPoints.Add(pAcquire); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(1200); switch (acquireType) { case "FMS": System.Diagnostics.Debug.Print("FMS Acquire"); Utility.AcqFMS(22, 120); break; default: System.Diagnostics.Debug.Print("NOT FMS/PANO/CEPH/CR Acquire"); break; } if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message); } else { pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string fmsID = parser.getStringWithPathAndType("trophy/object_info", "fms", "value"); string[] fmsIDs = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int fmsCount = fmsIDs.Length; string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount) { string FMSInternalID = fmsIDs[0]; XMLResult rslListPs = fmss.listFMSPresentationState(FMSInternalID); int matchItem = 0; for (int p = 0; p < rslListPs.MultiResults[0].Parameters.Count; p++) { if (psID.Contains(rslListPs.MultiResults[0].Parameters[p].ParameterValue)) matchItem++; } if (matchItem == psCount) { pAcquire.Outputs.AddParameter("List FMS presentationstate", "FMS Service", "Get PS from listFMSPresentationState and match"); } else { pAcquire.Outputs.AddParameter("List FMS presentationstate", "FMS Service", "Get PS from listFMSPresentationState but not match"); } XMLResult delFmsRls = fmss.deleteFMS("true", FMSInternalID); if (delFmsRls.IsErrorOccured) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Delete FMS Result", "FMS Service", delFmsRls.Message); pAcquire.Outputs.AddParameter("Delete FMS", "FMS Service", "Delete FMS Error"); break; } pAcquire.Outputs.AddParameter("Delete FMS Result", "FMS Service", delFmsRls.ResultContent); pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("Delete FMS and images", "FMS Service", "All images and fms has been deleted"); } else { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("getAcquisitionResult", "FMS Service", "No Image or PS id return"); } break; } if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message); break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!"); break; } } while (true); } SaveRound(r); } Output(); }
//Case 158: 1.3.8_GetFMSIndexedInfo_Normal public void Run_FMS_GetFMSIndexedInfo_Normal_Case158() { int runCount = 0; string acquireType = string.Empty; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); AcquisitionService acqs = new AcquisitionService(); FMSService fmss = new FMSService(); ImageService igs = new ImageService(); PresentationStateService pss = new PresentationStateService(); XMLParameter acq = new XMLParameter("acq_info"); XMLParameter FmsInfo = new XMLParameter("fms"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "acquireType") { acquireType = ids.InputParameters.GetParameter(i).Key; } if (ids.InputParameters.GetParameter(i).Step == "FMSInfo") { FmsInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition FMS"); r.CheckPoints.Add(pAcquire); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); switch (acquireType) { case "FMS": System.Diagnostics.Debug.Print("FMS Acquire"); Utility.AcqFMS(22, 60); break; default: System.Diagnostics.Debug.Print("NOT FMS/PANO/CEPH/CR Acquire"); break; } if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message); } else { pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string fmsID = parser.getStringWithPathAndType("trophy/object_info", "fms", "value"); string[] fmsIDs = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int fmsCount = fmsIDs.Length; string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount) { pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", getAcqRVG.ResultContent); string FMSInternalID = fmsIDs[0]; CheckPoint pFMS = new CheckPoint("Set FMS Info", "FMS Service"); r.CheckPoints.Add(pFMS); XMLResult rslSetFmsInfo = fmss.setFMSInfo(FmsInfo, FMSInternalID); if (rslSetFmsInfo.IsErrorOccured) { pFMS.Result = TestResult.Fail; pFMS.Outputs.AddParameter("Set FMS Result", "FMS Service", rslSetFmsInfo.ResultContent); } XMLResult rslGetFmsInfo = fmss.getFMSInfo(FMSInternalID); if (rslGetFmsInfo.IsErrorOccured) { pFMS.Result = TestResult.Fail; pFMS.Outputs.AddParameter("Get FMS Info Fail", "FMS Service", rslGetFmsInfo.ResultContent); } else { pFMS.Result = TestResult.Pass; pFMS.Outputs.AddParameter("Get FMS Info Result", "FMS Service", rslGetFmsInfo.ResultContent); int matchGetItem = 0; for (int setI = 0; setI < FmsInfo.Length; setI++) { for (int getI = 0; getI < rslGetFmsInfo.MultiResults[0].Parameters.Count; getI++) { if (rslGetFmsInfo.MultiResults[0].Parameters[getI].ParameterName == FmsInfo.Parameters[setI].ParameterName && rslGetFmsInfo.MultiResults[0].Parameters[getI].ParameterValue == FmsInfo.Parameters[setI].ParameterValue) matchGetItem++; } } if (matchGetItem == FmsInfo.Length) { pFMS.Result = TestResult.Pass; pFMS.Outputs.AddParameter("Get FMS Info Result Match Setting", "FMS Service", "Success"); } else { pFMS.Result = TestResult.Fail; pFMS.Outputs.AddParameter("Get FMS Info Result Not Match Setting", "FMS Service", "Failure"); } } XMLResult delFmsRls = fmss.deleteFMS("true", FMSInternalID); if (delFmsRls.IsErrorOccured) { pFMS.Result = TestResult.Fail; pFMS.Outputs.AddParameter("Delete FMS Result", "FMS Service", delFmsRls.Message); pFMS.Outputs.AddParameter("Delete FMS", "FMS Service", "Delete FMS Error"); break; } pFMS.Outputs.AddParameter("Delete FMS Result", "FMS Service", delFmsRls.ResultContent); pFMS.Outputs.AddParameter("Delete FMS and images", "FMS Service", "All images and fms has been deleted"); } else { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("getAcquisitionResult", "FMS Service", "No Image or PS id return"); } break; } if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message); break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!"); break; } } while (true); } SaveRound(r); } Output(); }
//Case 159: 1.3.8_1.3.8_DeleteFMS_Normal public void Run_FMS_DeleteFMS_Normal_Case159() { int runCount = 0; string acquireType = string.Empty; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); AcquisitionService acqs = new AcquisitionService(); FMSService fmss = new FMSService(); ImageService igs = new ImageService(); PresentationStateService pss = new PresentationStateService(); XMLParameter acq = new XMLParameter("acq_info"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "acquireType") { acquireType = ids.InputParameters.GetParameter(i).Key; } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition FMS"); r.CheckPoints.Add(pAcquire); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); switch (acquireType) { case "FMS": System.Diagnostics.Debug.Print("FMS Acquire"); Utility.AcqFMS(15, 300); //can not set too long, otherwise there may be overtaken images break; default: System.Diagnostics.Debug.Print("NOT FMS/PANO/CEPH/CR Acquire"); break; } if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message); } else { pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string fmsID = parser.getStringWithPathAndType("trophy/object_info", "fms", "value"); string[] fmsIDs = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int fmsCount = fmsIDs.Length; string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount) { string FMSInternalID = fmsIDs[0]; XMLResult delFmsRls = fmss.deleteFMS("true", FMSInternalID); if (delFmsRls.IsErrorOccured) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Delete FMS Result", "Acquisition", delFmsRls.ResultContent); pAcquire.Outputs.AddParameter("Delete FMS", "Acquisition", "Delete FMS Error"); break; } pAcquire.Outputs.AddParameter("Delete FMS Result", "Acquisition", delFmsRls.ResultContent); XMLResult getFmsRls = fmss.getFMSDescription(FMSInternalID); if (!getFmsRls.IsErrorOccured) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get FMS", "Acquisition", getFmsRls.ResultContent); pAcquire.Outputs.AddParameter("Get FMS", "Acquisition", "FMS does not delete"); break; } pAcquire.Outputs.AddParameter("Get FMS", "Acquisition", getFmsRls.ResultContent); bool isImageExisted = false; for (int i = 1; i <= imageIDs.Length; i++) { XMLResult getImageRls = igs.getImageDescription(imageIDs[i - 1]); if (!getImageRls.IsErrorOccured) { isImageExisted = true; break; } pAcquire.Outputs.AddParameter("Get FMS Images: " + i, "Acquisition", getImageRls.ResultContent); } if (isImageExisted) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get FMS Images", "Acquisition", "Images is not deleted from FMS"); break; } pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("Delete FMS and images", "Acquisition", "Fms and imahes have been deleted"); } else { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", "No Image or PS id return"); } break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message); } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!"); break; } } while (true); } SaveRound(r); } Output(); }
//Case 1091: 1.3.7_WorkFlow_AcquireRVG+SetImageInfo+GetPresentationStateInfo_RadioLogInformation public void Run_PS_Acq_Radiolog_Case1091() { //int runCount = this.Input.Repetition; int runCount = 0; // this is the initial run count. Use this count to repeat different test data set. foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Test round"); //Mark the check point here to indicate what's the check point here CheckPoint p1 = new CheckPoint("createPatient", "Setup environment of createPatient"); CheckPoint p2 = new CheckPoint("startAcquisition", "Setup environment of acquisition"); CheckPoint p3 = new CheckPoint("getAcquisitionResult", "Setup environment of image and PS id"); CheckPoint p4 = new CheckPoint("setImageInfo", "Setup environment of setImageInfo"); CheckPoint p5 = new CheckPoint("getImageInfo", "Test getImageInfo"); CheckPoint p6 = new CheckPoint("getPresentationStateInfo", "Test getPresentationStateInfo"); r.CheckPoints.Add(p1); r.CheckPoints.Add(p2); r.CheckPoints.Add(p3); r.CheckPoints.Add(p4); r.CheckPoints.Add(p5); r.CheckPoints.Add(p6); //create required PAS service instaces here PatientService pats = new PatientService(); AcquisitionService acq = new AcquisitionService(); ImageService img = new ImageService(); PresentationStateService ps = new PresentationStateService(); //create input parameters here, it may include XML path type and string type value XMLParameter pa1 = new XMLParameter("patient"); XMLParameter pa2 = new XMLParameter("acq_info"); XMLParameter pa3 = new XMLParameter("getAcquisitionResult"); XMLParameter pa4 = new XMLParameter("image"); XMLParameter pa5 = new XMLParameter("image"); XMLParameter pt6 = new XMLParameter("presentationstate"); XMLParameterCollection pa6 = new XMLParameterCollection(); try { for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "createPatient": pa1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "acquire": pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; case "setImageInfo": pa4.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); break; default: Console.WriteLine("There is no valid selection when parse input parameters."); break; } } //If we need change parameter by specific logic, please put code here //Get service result //Step1 result XMLResult step1_result = pats.createPatient(pa1); //Log step1 service output if (step1_result.IsErrorOccured) { p1.Result = TestResult.Fail; p1.Outputs.AddParameter("createPatient", "Error", step1_result.ResultContent); SaveRound(r); continue; } p1.Result = TestResult.Pass; p1.Outputs.AddParameter("createPatient", "Success", step1_result.ResultContent); //Change input parameter according the output of Step1 pa2.AddParameter("patient_internal_id", step1_result.SingleResult); //Step2 result //if acquireType isn't emtpy string, skip step2, here is only RVG acquisition bool acqflag = true; XMLResult step3_result = new XMLResult(); if (pa2.GetParameterValueByName("acquireType") == null || pa2.GetParameterValueByName("acquireType") == "") { XMLResult rslAcqRVG = acq.startAcquisition(pa2); System.Threading.Thread.Sleep(3000); if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); p2.Result = TestResult.Fail; p2.Outputs.AddParameter("acquire", "Acquire image error", rslAcqRVG.Message); } else { p2.Result = TestResult.Pass; p2.Outputs.AddParameter("acquire", "Acquire session ID", rslAcqRVG.SingleResult); int DORVGcount = 0; do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; step3_result = acq.getAcquisitionResult(rslAcqRVG.SingleResult); if (!step3_result.IsErrorOccured) { // move this to out of do-while loop as need check the return value is correct or not there //p3.Result = TestResult.Pass; //p3.Outputs.AddParameter("acquire", "Get acquire image", step3_result.Message); acqflag = false; break; } if (step3_result.Code != 501) { continue; } else { p3.Result = TestResult.Fail; p3.Outputs.AddParameter("acquire", "Get acquire image error", step3_result.Message); acqflag = false; } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { p3.Result = TestResult.Fail; p3.Outputs.AddParameter("acquire", "Get acquire image error", "Acquire greate with 3 minutes, timeout!"); acqflag = false; break; } } while (acqflag); } } //Change input parameter according the output of Step3 // if step3 is skipped, step4,step5,setp6 input has no need parameter of internal_id //2012-11-28/19006723: Chanege as ther getAcquisitionResult result change, need new way to get the image ID and PS ID string imgInternalID = string.Empty; string psInternalID = string.Empty; ParseXMLContent parser = new ParseXMLContent(step3_result.ResultContent); // To parse the return XML string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (imageCount == 1 && psCount == 1) { p3.Result = TestResult.Pass; p3.Outputs.AddParameter("acquire", "getAcquisitionResult return OK", step3_result.ResultContent); imgInternalID = imageIDs[0]; psInternalID = psIDs[0]; pa5.AddParameter("internal_id", imgInternalID); pt6.AddParameter("internal_id", psInternalID); } else { p3.Result = TestResult.Fail; p3.Outputs.AddParameter("acquire", "getAcquisitionResult return ERROR", step3_result.ResultContent); SaveRound(r); continue; // Not run below steps } //if (step3_result.MultiResults.Count > 0) //{ // for (int j = 0; j < step3_result.MultiResults.Count; j++) // { // for (int i = 0; i < step3_result.MultiResults[j].Parameters.Count; i++) // { // if (step3_result.MultiResults[j].Parameters[i].ParameterName == "image_internal_id") // { // imgInternalID = step3_result.MultiResults[j].Parameters[i].ParameterValue; // pa5.AddParameter("internal_id", step3_result.MultiResults[j].Parameters[i].ParameterValue); // } // if (step3_result.MultiResults[j].Parameters[i].ParameterName == "presentation_state_internal_id") // { // pt6.AddParameter("internal_id", step3_result.MultiResults[j].Parameters[i].ParameterValue); // } // } // } //} //Step4 result XMLResult step4_result = img.setImageInfo(pa4, imgInternalID); //Log step4 service output if (step4_result.IsErrorOccured) { p4.Result = TestResult.Fail; p4.Outputs.AddParameter("setImageInfo", "Error", step4_result.ResultContent); SaveRound(r); continue; } p4.Result = TestResult.Pass; p4.Outputs.AddParameter("setImageInfo", "Success", step4_result.ResultContent); //Step5 result XMLResult step5_result = img.getImageInfo(pa5); //Log step3 service output //Compare the Expected parameters of getImageInfo and output result of getImageInfo //count of compare matched parameters int compCount = 0; //count of expected parameters on getImageInfo int expectedParameterCount = 0; for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++) { if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo") { expectedParameterCount++; } } for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++) { if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo" && ids.ExpectedValues.Parameters[index].Value == step5_result.DicomArrayResult.GetParameterValueByName(ids.ExpectedValues.Parameters[index].Key)) { compCount++; } } if (step5_result.IsErrorOccured || compCount != expectedParameterCount) { p5.Result = TestResult.Fail; p5.Outputs.AddParameter("getImageInfo", "Error", step5_result.ResultContent); SaveRound(r); continue; } p5.Result = TestResult.Pass; p5.Outputs.AddParameter("getImageInfo", "Success", step5_result.ResultContent); //Change input parameter according the output of Step6 //generate input parameter collection of step6 pa6.Add(pt6); //Step6 result XMLResult step6_result = ps.getPresentationStateInfo(pa6); //Log step6 service output //Compare the Expected parameters of getPresentationStateInfo and output result of getPresentationStateInfo compCount = 0; //count of expected parameters on getPresentationStateInfo expectedParameterCount = 0; for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++) { if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo") { expectedParameterCount++; } } for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++) { if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo" && ids.ExpectedValues.Parameters[index].Value == step6_result.DicomArrayResult.GetParameterValueByName(ids.ExpectedValues.Parameters[index].Key)) { compCount++; } } if (step6_result.IsErrorOccured || compCount != expectedParameterCount) { p6.Result = TestResult.Fail; p6.Outputs.AddParameter("getPresentationStateInfo", "Error", step6_result.ResultContent); } else { p6.Result = TestResult.Pass; p6.Outputs.AddParameter("getPresentationStateInfo", "Success", step6_result.ResultContent); } //Save data for each round SaveRound(r); } catch (Exception ex) { CheckPoint p = new CheckPoint("Excepption", "Exception thrown when case run: "+ex.ToString()); r.CheckPoints.Add(p); SaveRound(r); } } //Save service log as xml file Output(); }
public override void Run() { string newPSId = string.Empty; string setPSInfoString = string.Empty; string getPSInfoString = string.Empty; PresentationStateService psService = new PresentationStateService(); try { //create a new patient and import a new image to get a new ps id. string newPatientId = CommonLib.CreatePatient(); ImportService import = new ImportService(); XMLResult r = import.importObject(newPatientId, string.Empty, @"c:\PASPerformance\001.png", null, true, string.Empty); newPSId = r.MultiResults[1].GetParameterValueByIndex(0); XMLParameter psId = new XMLParameter("presentationstate"); psId.AddParameter("internal_id", newPSId); getPSInfoString = psId.GenerateXML(); XMLParameterCollection c = new XMLParameterCollection(); c.Add(psId); setPSInfoString = psService.getPresentationStateInfo(c).ArrayResult.GenerateXML(); } catch (Exception ex) { LogRecordType lr = new LogRecordType(); lr.FunctionName = this.mFunctionName; lr.Lable = this.mLabel; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; lr.Passed = false; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true); this.RiseTestCaseCompleteEvent(); this.mExecuted = this.mRepeat; this.mFailed = this.mRepeat; return; } double userCaseResponse=0; for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; try { //get ps info XMLResult getResult=new XMLResult (psService.InvokeMethod ("getPresentationStateInfo", new object []{getPSInfoString })); //if get presentation infor failed. if (getResult.IsErrorOccured) { lr.Message = "Get PS info faild. Message: " + getResult.Message; lr.ResponseTime = psService.ResponseTime; lr.Passed = false; Log.AddRecord(lr); this.mFailed++; continue; } else //if get ps info successed { userCaseResponse = psService.ResponseTime; } //set ps info XMLResult setResult = new XMLResult(psService.InvokeMethod("setPresentationStateInfo", new object[] { setPSInfoString, newPSId})); //if set ps info failed if (setResult.IsErrorOccured) { lr.Message = "Set PS info failed. Message: " + setResult.Message; lr.ResponseTime = psService.ResponseTime; lr.Passed = false; Log.AddRecord(lr); this.mFailed++; continue; } else //if set ps info successed. { userCaseResponse += psService.ResponseTime; } lr.ResponseTime = userCaseResponse; this.ExecutedTime += userCaseResponse; } catch (Exception ex) { this.mFailed++; lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; } this.mExecuted = i; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }
public override void Run() { string newPatientId = string.Empty; string psId = string.Empty; string PsInfoString = string.Empty; PresentationStateService ps = new PresentationStateService(); try { //create a new patient and import a new image to get a new ps id. newPatientId = CommonLib.CreatePatient(); ImportService import = new ImportService(); XMLResult importResult = import.importObject(newPatientId, string.Empty, @"c:\PASPerformance\001.png", null, true, string.Empty); psId = importResult.MultiResults[1].GetParameterValueByIndex(0); //Get PS info string. PsInfoString = ps.getPresentationState(psId).ArrayResult.GenerateXML(); } catch (Exception ex) { LogRecordType lr = new LogRecordType(); lr.FunctionName = this.mFunctionName; lr.Lable = this.mLabel; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; lr.Passed = false; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true); this.RiseTestCaseCompleteEvent(); this.mExecuted = this.mRepeat; this.mFailed = this.mRepeat; return; } for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; double userCaseResponse = 0; try { //get ps XMLResult getPsResult = ps.getPresentationState(psId); if (getPsResult.IsErrorOccured) { lr.Passed = false; lr.Message = getPsResult.Message; lr.ResponseTime = ps.ResponseTime; Log.AddRecord(lr); this.mFailed++; continue; } else userCaseResponse = ps.ResponseTime; //set ps XMLResult setPsResult = new XMLResult(ps.InvokeMethod("setPresentationState", new object[] { PsInfoString, psId })); if (setPsResult.IsErrorOccured) { lr.Passed = false; lr.Message = setPsResult.Message; lr.ResponseTime = ps.ResponseTime; Log.AddRecord(lr); this.mFailed++; continue; } else userCaseResponse += ps.ResponseTime; //if no exception. lr.Passed = true; lr.ResponseTime = userCaseResponse; this.mExectuedTime += userCaseResponse; } catch (Exception ex) { lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; this.mFailed++; } Log.AddRecord(lr); this.mExecuted = i; this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }
public static string AcquireFMS(XMLParameter acq) { string rt_fmsID = string.Empty; AcquisitionService acqs = new AcquisitionService(); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); Utility.AcqFMS(40, 300); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string fmsID = parser.getStringWithPathAndType("trophy/object_info", "fms", "value"); string[] fmsIDs = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int fmsCount = fmsIDs.Length; string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount) { rt_fmsID = fmsIDs[0]; } else { rt_fmsID = ""; } break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) { continue; } if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { rt_fmsID = string.Empty; } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { rt_fmsID = string.Empty; break; } } while (true); return(rt_fmsID); }
public override void Run() { AcquisitionService acqService = new AcquisitionService(); double timeOut = 60000; //60000ms, 60s XMLParameter acqInfo = new XMLParameter("acq_info"); try { string PatientId = CommonLib.CreatePatient(); acqInfo.AddParameter("patient_internal_id", PatientId); acqInfo.AddParameter("teeth_number", "12"); acqInfo.AddParameter("teeth_number_notation", "american"); acqInfo.AddParameter("output_encoding", "unicode"); acqInfo.AddParameter("series_performing_physician_name", "performing_physician_name"); acqInfo.AddParameter("mpps_information", "mpps_information"); acqInfo.AddParameter("equipment_department_name", "equipment_department_name"); acqInfo.AddParameter("equipment_institution_name", "equipment_institution_name"); acqInfo.AddParameter("equipment_institution_address", "equipment_institution_address"); acqInfo.AddParameter("equipment_station_name", "equipment_station_name"); } catch (Exception ex) { LogRecordType lr = new LogRecordType(); lr.FunctionName = this.mFunctionName; lr.Lable = this.mLabel; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; lr.Passed = false; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true); this.RiseTestCaseCompleteEvent(); this.mExecuted = this.mRepeat; this.mFailed = this.mRepeat; return; } for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; try { XMLResult result = new XMLResult(); lr.ResponseTime = 0; do { ExactTimer timer = new ExactTimer(); timer.Start(); result = acqService.setAsynAcqPatientInfo(acqInfo); timer.Stop(); lr.ResponseTime += timer.Duration; System.Threading.Thread.Sleep(100); } while (result.ResultContent == null && lr.ResponseTime < timeOut); //loop while there is no return, and the time out is 60s lr.Passed = !(result.IsErrorOccured); if (!lr.Passed) { if (lr.ResponseTime >= timeOut) lr.Message = "the service did not return after 60s. " + result.Message; else lr.Message = "the service return errors: " + result.Message; this.mFailed++; } else // lr.Passed = true { lr.Message = result.Message; this.mExectuedTime += lr.ResponseTime; } } catch (Exception ex) { this.mFailed++; lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; } this.mExecuted = i; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }
public void Run_Acquisition_AcquireRVG_Case1108() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); AcquisitionService acqs = new AcquisitionService(); XMLParameter acq = new XMLParameter("acq_info"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition RVG"); r.CheckPoints.Add(pAcquire); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message); } else { pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (imageCount == 1 && psCount == 1) { pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", getAcqRVG.ResultContent); } else { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition return error.", getAcqRVG.ResultContent); } break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message); } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!"); break; } } while (true); } SaveRound(r); } Output(); }
public void Run_Acquisition_Notification_Case985() { int runCount = 0; string patientUID = string.Empty; bool isCreatePatient = false; string stopMessageType = "teststop"; string stopMessageContent = "teststop"; NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification(); //NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification("10.112.39.167"); System.Collections.Generic.List<string> rms = new System.Collections.Generic.List<string>(); rms.Add("topic.patientCreated"); rms.Add("topic.acquisitionCompleted"); rms.Add("topic.imageCreated"); rms.Add("topic.presentationStateModified"); rn.startListon(rms, stopMessageType, stopMessageContent); foreach (InputDataSet ids in this.Input.DataSets) { isCreatePatient = false; runCount++; Round r = this.NewRound(runCount.ToString(), "Acquire image"); CheckPoint pCreate = new CheckPoint("Create Patient", "Test create"); r.CheckPoints.Add(pCreate); PatientService ps = new PatientService(); AcquisitionService acqs = new AcquisitionService(); ApplicationService ass = new ApplicationService(); XMLParameter pa = new XMLParameter("patient"); XMLParameter acq = new XMLParameter("acq_info"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "create") { pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); isCreatePatient = true; } if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } if (isCreatePatient) { XMLResult result = ps.createPatient(pa); if (!result.IsErrorOccured) { pCreate.Result = TestResult.Pass; patientUID = result.SingleResult; pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID); } else { pCreate.Result = TestResult.Fail; pCreate.Outputs.AddParameter("create patient error", "Create patient", result.Message); } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Test acquire"); r.CheckPoints.Add(pAcquire); acq.AddParameter("patient_internal_id", patientUID); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcq = acqs.startAcquisition(acq); System.Diagnostics.Debug.Print("Acquire :"); System.Threading.Thread.Sleep(5000); if (rslAcq.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("acquire", "Acquire image error", rslAcq.Message); } else { pAcquire.Outputs.AddParameter("acquire", "Acquire session ID", rslAcq.SingleResult); int DOcount = 0; XMLResult getAcq = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DOcount++; getAcq = acqs.getAcquisitionResult(rslAcq.SingleResult); if (!getAcq.IsErrorOccured) { pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("acquire", "Get acquire image", getAcq.Message); break; } if (getAcq.IsErrorOccured && getAcq.Code != 499) continue; if (getAcq.Code != 0 && getAcq.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("acquire", "Get acquire image error", getAcq.Message); break; } System.Diagnostics.Debug.Print("get acquireResult:" + DOcount); if (DOcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("acquire", "Get acquire image error", "Acquire greate with 3 minutes, timeout!"); break; } } while (true); } System.Threading.Thread.Sleep(500); ass.sendGenericNotification(stopMessageType, stopMessageContent); System.Threading.Thread.Sleep(500); int getn = rn.getNotificationNumber(); CheckPoint pNotification = new CheckPoint("Receive Notification", "acquire message"); r.CheckPoints.Add(pNotification); if (getn == 4) { pNotification.Result = TestResult.Pass; foreach (string mmm in rn.getNotificationContent()) { pNotification.Outputs.AddParameter("Notification message", "Content:", mmm); } } else { pNotification.Result = TestResult.Fail; foreach (string mmm in rn.getNotificationContent()) { pNotification.Outputs.AddParameter("Notification message", "Content:", mmm); } pNotification.Outputs.AddParameter("Message", "Content:", "miss message on receive"); } SaveRound(r); } Output(); }
//Case 980: 1.3.17_workflow_CSI select a patient, open an image and then close it public void Run_WorkFlow_CSIOpenImageAndClose_Case980() { // Test Case added for work flow: CSI select a patient to list all the image, click to open one of them and then save and close it. PatientService patientService = new PatientService(); AcquisitionService acquisitionService = new AcquisitionService(); PresentationStateService presentationStateService = new PresentationStateService(); AnalysisService analysisService = new AnalysisService(); string patientUID = null; XMLParameter setAsynAcqPatientInfoParam = new XMLParameter("acq_info"); XMLParameter listObjectForPSParam = new XMLParameter("filter"); XMLParameterCollection getPresentionStateInfoParam = new XMLParameterCollection(); XMLParameter listObjectForVolumeParam = new XMLParameter("filter"); XMLParameter listObjectForFMSParam = new XMLParameter("filter"); XMLParameter listObjectForOtherParam = new XMLParameter("filter"); XMLParameter setPresentationStateParam = new XMLParameter("presentationstate"); XMLParameter setPresentationStateInfoParam = new XMLParameter("presentationstate"); XMLParameter listObjectForAnalysisParam = new XMLParameter("filter"); XMLParameter setAnalysisInfoParam = new XMLParameter("analysis"); foreach (InputDataSet ids in this.Input.DataSets) { Round r = new Round(); try { for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "getPatient") { if (ids.InputParameters.GetParameter(i).Key == "patientInternalID") { patientUID = ids.InputParameters.GetParameter(i).Value; } } if (ids.InputParameters.GetParameter(i).Step == "setAsynAcqPatientInfo") { setAsynAcqPatientInfoParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "listObjectForPS") { listObjectForPSParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "listObjectForVolume") { listObjectForVolumeParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "listObjectForFMS") { listObjectForFMSParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "listObjectForOther") { listObjectForOtherParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "listObjectForAnalysis") { listObjectForAnalysisParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "setPresentationStateInfo") { setPresentationStateInfoParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } if (ids.InputParameters.GetParameter(i).Step == "setAnalysisInfo") { setAnalysisInfoParam.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } #region Step 1: Check the specific patient exists in Database CheckPoint pGetPatient = new CheckPoint("getPatient", "Step 1: Get the specific patient info"); r.CheckPoints.Add(pGetPatient); XMLResult getPatientResult = patientService.getPatient(patientUID); if (getPatientResult.IsErrorOccured) { pGetPatient.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Get the specific patient info fail:"); pGetPatient.Outputs.AddParameter("getPatient", "get the specific patient info", getPatientResult.Message); SaveRound(r); break; } else { pGetPatient.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Get the specific patient info succeed:"); pGetPatient.Outputs.AddParameter("getPatient", "get the specific patient info", getPatientResult.Message); } #endregion // Step 2 - Step 7 are what to do after select a patient #region Step 2: set asyn acq patient with the specific patient CheckPoint pSetAsynAcqPatientInfo = new CheckPoint("setAsynAcqPatientInfo", "Step 2: call setAsynAcqPatientInfo to set asyn acq patient info"); r.CheckPoints.Add(pSetAsynAcqPatientInfo); XMLResult setAsynAcqPatientInfoResult = acquisitionService.setAsynAcqPatientInfo(setAsynAcqPatientInfoParam); if (setAsynAcqPatientInfoResult.IsErrorOccured) { pSetAsynAcqPatientInfo.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Set asyn acq PatientInfo fail:"); pSetAsynAcqPatientInfo.Outputs.AddParameter("setAsynAcqPatientInfo", "set asyn acq patient info", setAsynAcqPatientInfoResult.Message); SaveRound(r); break; } else { pSetAsynAcqPatientInfo.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Set asyn acq PatientInfo succeed:"); pSetAsynAcqPatientInfo.Outputs.AddParameter("setAsynAcqPatientInfo", "set asyn acq patient info", setAsynAcqPatientInfoResult.Message); } #endregion #region Step 3: Call listObject to get the presentation state list of the patient CheckPoint pListObjectForPS = new CheckPoint("listObjectForPS", "Step 3: call listObject to get PS info"); r.CheckPoints.Add(pListObjectForPS); XMLResult listObjectForPSResult = patientService.listObjects(listObjectForPSParam); if (listObjectForPSResult.IsErrorOccured) { pListObjectForPS.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get PS info fail:"); pListObjectForPS.Outputs.AddParameter("listObject", "listObject to get PS", listObjectForPSResult.Message); SaveRound(r); break; } else { pListObjectForPS.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get PS info succeed:"); pListObjectForPS.Outputs.AddParameter("listObject", "listObject to get PS", listObjectForPSResult.Message); } #endregion #region Step 4: Call getPresentationStateInfo to get the presentationstate info according to the presentationstate internal_id CheckPoint pGetPresentionStateInfo = new CheckPoint("getPresentionStateInfo", "Step 4: call getPresentationStateInfo to get presention state info"); r.CheckPoints.Add(pGetPresentionStateInfo); foreach (XMLParameter param in listObjectForPSResult.MultiResults) { getPresentionStateInfoParam.Add(param); } XMLResult getPresentationStateInfoResult = presentationStateService.getPresentationStateInfo(getPresentionStateInfoParam); if (getPresentationStateInfoResult.IsErrorOccured) { pGetPresentionStateInfo.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call getPresentationStateInfo to get PS info fail:"); pGetPresentionStateInfo.Outputs.AddParameter("getPresentationStateInfo", "getPresentationStateInfo to get PS info", getPresentationStateInfoResult.Message); SaveRound(r); break; } else { pGetPresentionStateInfo.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call getPresentationStateInfo to get PS info succeed:"); pGetPresentionStateInfo.Outputs.AddParameter("getPresentationStateInfo", "getPresentationStateInfo to get PS info", getPresentationStateInfoResult.Message); } #endregion #region Step 5: Call listObject to get the volume list of the patient CheckPoint pListObjectForVolume = new CheckPoint("listObjectForVolume", "Step 5: call listObject to get volume info"); r.CheckPoints.Add(pListObjectForVolume); XMLResult listObjectForVolumeResult = patientService.listObjects(listObjectForVolumeParam); if (listObjectForVolumeResult.IsErrorOccured) { pListObjectForVolume.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get volume info fail:"); pListObjectForVolume.Outputs.AddParameter("listObject", "listObject to get volume", listObjectForVolumeResult.Message); SaveRound(r); break; } else { pListObjectForVolume.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get volume info succeed:"); pListObjectForVolume.Outputs.AddParameter("listObject", "listObject to get volume", listObjectForVolumeResult.Message); } #endregion #region Step 6: Call listObject to get the FMS list of the patient CheckPoint pListObjectForFMS = new CheckPoint("listObjectForFMS", "Step 6: call listObject to get FMS info"); r.CheckPoints.Add(pListObjectForFMS); XMLResult listObjectForFMSResult = patientService.listObjects(listObjectForFMSParam); if (listObjectForFMSResult.IsErrorOccured) { pListObjectForFMS.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get FMS info fail:"); pListObjectForFMS.Outputs.AddParameter("listObject", "listObject to get FMS", listObjectForFMSResult.Message); SaveRound(r); break; } else { pListObjectForFMS.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get FMS info succeed:"); pListObjectForFMS.Outputs.AddParameter("listObject", "listObject to get FMS", listObjectForFMSResult.Message); } #endregion #region Step 7: Call listObject to get the other info of the patient CheckPoint pListObjectForOther = new CheckPoint("listObjectForOther", "Step 7: call listObject to get other info"); r.CheckPoints.Add(pListObjectForOther); XMLResult listObjectForOtherResult = patientService.listObjects(listObjectForOtherParam); if (listObjectForOtherResult.IsErrorOccured) { pListObjectForOther.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get other info fail:"); pListObjectForOther.Outputs.AddParameter("listObject", "listObject to get other", listObjectForOtherResult.Message); SaveRound(r); break; } else { pListObjectForOther.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get other info succeed:"); pListObjectForOther.Outputs.AddParameter("listObject", "listObject to get other", listObjectForOtherResult.Message); } #endregion // After double click an image to open it, it will repeat step 3 to step 7 // When open image, it will call getPresentationState to get the presentation state, which can be used in setPresentationState step later string presentationStateInternalID = null; XMLParameterCollection setPresentationStateParamList = new XMLParameterCollection(); foreach (XMLParameterNode psNode in listObjectForPSResult.ArrayResult.Parameters) { presentationStateInternalID = psNode.ParameterValue; XMLResult getPresentationStateResult = presentationStateService.getPresentationState(presentationStateInternalID); setPresentationStateParam = getPresentationStateResult.ArrayResult; setPresentationStateParamList.Add(setPresentationStateParam); } // Close the image, it will do step 8 to step 10 #region Step 8: Call setPresentationState to set presentation state, not change the presentation state value, just set it back CheckPoint pSetPresentationState = new CheckPoint("setPresentationState", "Step 8: call setPresentationState to set the presentation state after close the image"); r.CheckPoints.Add(pSetPresentationState); XMLResult setPresentationStateResult = new XMLResult(); foreach (XMLParameter presentationStateInfo in setPresentationStateParamList) { setPresentationStateResult = presentationStateService.setPresentationState(presentationStateInfo, presentationStateInternalID); if (setPresentationStateResult.IsErrorOccured) { pSetPresentationState.Result = TestResult.Fail; break; } else { pSetPresentationState.Result = TestResult.Pass; } } if (pSetPresentationState.Result == TestResult.Fail) { System.Diagnostics.Debug.Print("Call setPresentationState to set presentation state fail:"); pSetPresentationState.Outputs.AddParameter("setPresentationState", "setPresentationState to set presentation state", setPresentationStateResult.Message); SaveRound(r); break; } else { System.Diagnostics.Debug.Print("Call setPresentationState to set presentation state succeed:"); pSetPresentationState.Outputs.AddParameter("setPresentationState", "setPresentationState to set presentation state", setPresentationStateResult.Message); } #endregion #region Step 9: Call setPresentationStateInfo to set the presentation state info CheckPoint pSetPresentationStateInfo = new CheckPoint("setPresentationStateInfo", "Step 9: call setPresentationStateInfo to set the presentation state info after close the image"); r.CheckPoints.Add(pSetPresentationStateInfo); XMLResult setPresentationStateInfoResult = new XMLResult(); foreach (XMLParameter presentationStateInfoParam in getPresentationStateInfoResult.MultiResults) { presentationStateInternalID = presentationStateInfoParam.GetParameterValueByName("internal_id"); setPresentationStateInfoResult = presentationStateService.setPresentationStateInfo(setPresentationStateInfoParam, presentationStateInternalID); if (setPresentationStateInfoResult.IsErrorOccured) { pSetPresentationStateInfo.Result = TestResult.Fail; break; } else { pSetPresentationStateInfo.Result = TestResult.Pass; } } if (pSetPresentationStateInfo.Result == TestResult.Fail) { System.Diagnostics.Debug.Print("Call setPresentationStateInfo to set presentation state info fail:"); pSetPresentationStateInfo.Outputs.AddParameter("setPresentationStateInfo", "setPresentationState to set presentation state info", setPresentationStateInfoResult.Message); SaveRound(r); break; } else { System.Diagnostics.Debug.Print("Call setPresentationStateInfo to set presentation state info succeed:"); pSetPresentationStateInfo.Outputs.AddParameter("setPresentationState", "setPresentationState to set presentation state info", setPresentationStateInfoResult.Message); } #endregion #region Step 10: Call listObject to get the presentation state CheckPoint pListObjectForPS2 = new CheckPoint("listObjectForPS", "Step 10: call listObject to get PS info after close image"); r.CheckPoints.Add(pListObjectForPS2); XMLResult listObjectForPSResult2 = patientService.listObjects(listObjectForPSParam); if (listObjectForPSResult2.IsErrorOccured) { pListObjectForPS.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get PS info fail:"); pListObjectForPS2.Outputs.AddParameter("listObject", "listObject to get PS", listObjectForPSResult2.Message); SaveRound(r); break; } else { pListObjectForPS2.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get PS info succeed:"); pListObjectForPS2.Outputs.AddParameter("listObject", "listObject to get PS", listObjectForPSResult2.Message); } #endregion #region Step 11: Call getPresentationStateInfo to get the presentation state info CheckPoint pGetPresentionStateInfo2 = new CheckPoint("getPresentionStateInfo", "Step 11: call getPresentationStateInfo to get presention state info after close image"); r.CheckPoints.Add(pGetPresentionStateInfo2); XMLResult getPresentationStateInfoResult2 = presentationStateService.getPresentationStateInfo(getPresentionStateInfoParam); if (getPresentationStateInfoResult2.IsErrorOccured) { pGetPresentionStateInfo2.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call getPresentationStateInfo to get PS info fail:"); pGetPresentionStateInfo2.Outputs.AddParameter("getPresentationStateInfo", "getPresentationStateInfo to get PS info", getPresentationStateInfoResult2.Message); SaveRound(r); break; } else { pGetPresentionStateInfo2.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call getPresentationStateInfo to get PS info succeed:"); pGetPresentionStateInfo2.Outputs.AddParameter("getPresentationStateInfo", "getPresentationStateInfo to get PS info", getPresentationStateInfoResult2.Message); } #endregion // Close the viewer #region Step 12: Call listObject to get the analysis CheckPoint pListObjectForAnalysis = new CheckPoint("listObjectForAnalysis", "Step 12: call listObject to get analysis info"); r.CheckPoints.Add(pListObjectForAnalysis); XMLResult listObjectForAnalysisResult = patientService.listObjects(listObjectForAnalysisParam); if (listObjectForAnalysisResult.IsErrorOccured) { pListObjectForAnalysis.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call listObject to get analysis info fail:"); pListObjectForAnalysis.Outputs.AddParameter("listObject", "listObject to get analysis", listObjectForAnalysisResult.Message); SaveRound(r); break; } else { pListObjectForAnalysis.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call listObject to get analysis info succeed:"); pListObjectForAnalysis.Outputs.AddParameter("listObject", "listObject to get analysis", listObjectForAnalysisResult.Message); } #endregion string analysisId = null; analysisId = listObjectForAnalysisResult.SingleResult; if (analysisId == null || analysisId == string.Empty) { // Below Step are excuted when there is no analysis before #region Step 13: createAnalysis CheckPoint pCreateAnalysis = new CheckPoint("createAnalysis", "Step 13: call createAnalysis to create new analysis"); r.CheckPoints.Add(pCreateAnalysis); XMLResult createAnalysisResult = new XMLResult(); XMLParameter analysisXml = new XMLParameter("analysis"); XMLParameterCollection uidsXml = new XMLParameterCollection(); XMLParameter presentationStateUids = new XMLParameter("presentationstate"); XMLParameter fmsUids = new XMLParameter("fms"); uidsXml.Add(presentationStateUids); uidsXml.Add(fmsUids); createAnalysisResult = analysisService.createAnalysis(analysisXml.GenerateXML().ToString(), true, true, patientUID, null, uidsXml); // public XMLResult createAnalysis(string analysisXml, bool current, bool currentSpecified, string patientInternalID, string thumbnail, XMLParameterCollection uidsXml); if (createAnalysisResult.IsErrorOccured) { System.Diagnostics.Debug.Print("Call createAnalysis to create analysis fail:"); pCreateAnalysis.Outputs.AddParameter("createAnalysis", "createAnalysis to create analysis", createAnalysisResult.Message); SaveRound(r); break; } else { System.Diagnostics.Debug.Print("Call createAnalysis to create analysis succeed:"); pCreateAnalysis.Outputs.AddParameter("createAnalysis", "createAnalysis to create analysis", createAnalysisResult.Message); } #endregion #region Step 14: Call AnalysisService.setAnalysisInfo to set the analysis info CheckPoint pSetAnalysisInfo = new CheckPoint("setAnalysisInfo", "Step 14: call setAnalysisInfo to set the analysis info"); r.CheckPoints.Add(pSetAnalysisInfo); XMLResult setAnalysisInfoResult = new XMLResult(); analysisId = createAnalysisResult.MultiResults[0].GetParameterValueByName("internal_id"); setAnalysisInfoResult = analysisService.setAnalysisInfo(analysisId, setAnalysisInfoParam); if (setAnalysisInfoResult.IsErrorOccured) { System.Diagnostics.Debug.Print("Call setAnalysisInfo to set analysis info fail:"); pSetAnalysisInfo.Outputs.AddParameter("setAnalysisInfo", "setAnalysisInfo to set analysis info", setAnalysisInfoResult.Message); SaveRound(r); break; } else { System.Diagnostics.Debug.Print("Call setAnalysisInfo to set analysis info succeed:"); pSetAnalysisInfo.Outputs.AddParameter("setAnalysisInfo", "setAnalysisInfo to set analysis info", setAnalysisInfoResult.Message); } #endregion } else { // Below Step 15 to Step 17 are excuted when there is analysis exist before... #region Step 15: Call AnalysisService.getAnalysisInfo to get the analysis info CheckPoint pGetAnalysisInfo = new CheckPoint("getAnalysisInfo", "Step 15: call getAnalysisInfo to get the analysis info"); r.CheckPoints.Add(pGetAnalysisInfo); XMLResult getAnalysisInfoResult = new XMLResult(); getAnalysisInfoResult = analysisService.getAnalysisInfo(analysisId); if (getAnalysisInfoResult.IsErrorOccured) { pGetAnalysisInfo.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call getAnalysisInfo to get analysis info fail:"); pGetAnalysisInfo.Outputs.AddParameter("getAnalysisInfo", "getAnalysisInfo to get analysis info", getAnalysisInfoResult.Message); SaveRound(r); break; } else { pGetAnalysisInfo.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call getAnalysisInfo to get analysis info succeed:"); pGetAnalysisInfo.Outputs.AddParameter("getAnalysisInfo", "getAnalysisInfo to get analysis info", getAnalysisInfoResult.Message); } #endregion #region Step 16: Call AnalysisService.setAnalysisDescription to set analysis description CheckPoint pSetAnalysisDescription = new CheckPoint("setAnalysisDescription", "Step 16: call setAnalysisDescription to set the analysis description"); r.CheckPoints.Add(pSetAnalysisDescription); XMLResult setAnalysisDescriptionResult = new XMLResult(); XMLParameter analysisXml = new XMLParameter("analysis"); XMLParameterCollection uidsXml = new XMLParameterCollection(); XMLParameter presentationStateUids = new XMLParameter("presentationstate"); XMLParameter fmsUids = new XMLParameter("fms"); uidsXml.Add(presentationStateUids); uidsXml.Add(fmsUids); setAnalysisDescriptionResult = analysisService.setAnalysisDescription(analysisId, analysisXml.GenerateXML(), false, uidsXml); if (setAnalysisDescriptionResult.IsErrorOccured) { pSetAnalysisDescription.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call setAnalysisDescription to set the analysis description fail:"); pSetAnalysisDescription.Outputs.AddParameter("setAnalysisDescription", "call set the analysis description", setAnalysisDescriptionResult.Message); SaveRound(r); break; } else { pSetAnalysisDescription.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call setAnalysisDescription to set the analysis description succeed:"); pSetAnalysisDescription.Outputs.AddParameter("setAnalysisDescription", "call set the analysis description", setAnalysisDescriptionResult.Message); } #endregion #region Step 17: Call AnalysisService.setAnalysisInfo to set the analysis info CheckPoint pSetAnalysisInfo = new CheckPoint("setAnalysisInfo", "Step 17: call setAnalysisInfo to set the analysis info"); r.CheckPoints.Add(pSetAnalysisInfo); XMLResult setAnalysisInfoResult = new XMLResult(); setAnalysisInfoResult = analysisService.setAnalysisInfo(analysisId, setAnalysisInfoParam); if (setAnalysisInfoResult.IsErrorOccured) { pSetAnalysisInfo.Result = TestResult.Fail; System.Diagnostics.Debug.Print("Call setAnalysisInfo to set analysis info fail:"); pSetAnalysisInfo.Outputs.AddParameter("setAnalysisInfo", "setAnalysisInfo to set analysis info", setAnalysisInfoResult.Message); SaveRound(r); break; } else { pSetAnalysisInfo.Result = TestResult.Pass; System.Diagnostics.Debug.Print("Call setAnalysisInfo to set analysis info succeed:"); pSetAnalysisInfo.Outputs.AddParameter("setAnalysisInfo", "setAnalysisInfo to set analysis info", setAnalysisInfoResult.Message); } #endregion } SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message); cp.Result = TestResult.Fail; SaveRound(r); } } Output(); }
public override void Run() { string acqInfoString = string.Empty; string sessionId = string.Empty; AcquisitionService acqService = new AcquisitionService(); ExactTimer timer = new ExactTimer(); int timeOut=600; try { LaunchNotification(); string PatientId = CommonLib.CreatePatient(); XMLParameter acqInfo = new XMLParameter("acq_info"); acqInfo.AddParameter("device_id", "AcqImgFiles.dll"); acqInfo.AddParameter("line_id", "308C0000"); acqInfo.AddParameter("patient_internal_id", PatientId); acqInfo.AddParameter("series_performing_physician_name", "performing_physician_name"); acqInfoString = acqInfo.GenerateXML(); } catch (Exception ex) { LogRecordType lr = new LogRecordType(); lr.FunctionName = this.mFunctionName; lr.Lable = this.mLabel; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; lr.Passed = false; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true); this.RiseTestCaseCompleteEvent(); this.mExecuted = this.mRepeat; this.mFailed = this.mRepeat; return; } for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; try { int attemp = 0; int errorCode = 272; //the error code for session existed. XMLResult result=new XMLResult (); timer.Start(); while (errorCode == 272) { result = new XMLResult(acqService.InvokeMethod("startAcquisition", new object[] { acqInfoString })); errorCode = result.Code; } sessionId = result.SingleResult; XMLResult acqResult = acqService.getAcquisitionResult(sessionId); while (acqResult.IsErrorOccured && attemp < timeOut) //loop while the result code is 0, and the time out is 60s { acqResult = acqService.getAcquisitionResult(sessionId); System.Threading.Thread.Sleep(100); attemp++; } timer.Stop(); lr.ResponseTime = timer.Duration; lr.Passed = !(acqResult.IsErrorOccured); if (!lr.Passed) { if (attemp >= timeOut) lr.Message = "the service did not return after 60s. "+acqResult.Message; else lr.Message = acqResult.Message; this.mFailed++; } else { lr.Message = result.SingleResult +"code: "+ result.Code; this.mExectuedTime += lr.ResponseTime; } } catch (Exception ex) { this.mFailed++; lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; } this.mExecuted = i; Log.AddRecord(lr); if(i == this.mRepeat) FinishNotification(); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }
public static string AcquireFMS(XMLParameter acq) { string rt_fmsID = string.Empty; AcquisitionService acqs = new AcquisitionService(); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); Utility.AcqFMS(40, 300); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string fmsID = parser.getStringWithPathAndType("trophy/object_info", "fms", "value"); string[] fmsIDs = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int fmsCount = fmsIDs.Length; string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount) { rt_fmsID = fmsIDs[0]; } else { rt_fmsID = ""; } break; } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) { continue; } if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { rt_fmsID = string.Empty; } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { rt_fmsID = string.Empty; break; } } while (true); return rt_fmsID; }
public override void Run() { string openObjInfo = string.Empty; string psId = string.Empty; KDIS7ImageWindow iw = new KDIS7ImageWindow(); KDIS7ATAssistant ka = new KDIS7ATAssistant(); ApplicationService appService = new ApplicationService(); try { string PatientId = CommonLib.CreatePatient(); ImportService import = new ImportService(); XMLResult importResult = import.importObject(PatientId, string.Empty, @"c:\PASPerformance\001.png",null, true, string.Empty); psId = importResult.MultiResults[1].GetParameterValueByIndex(0); XMLParameter pa = new XMLParameter("two_dimension_viewer"); pa.AddParameter("internal_id", psId); openObjInfo = pa.GenerateXML(); appService.openObjects(pa); iw.ItemByID(psId).WaitProperty("ShownOnScreen", true, 60); } catch (Exception ex) { LogRecordType lr = new LogRecordType(); lr.FunctionName = this.mFunctionName; lr.Lable = this.mLabel; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; lr.Passed = false; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true); this.RiseTestCaseCompleteEvent(); this.mExecuted = this.mRepeat; this.mFailed = this.mRepeat; return; } for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; try { XMLResult result = new XMLResult(appService.InvokeMethod("openObjects", new object[] { openObjInfo })); lr.ResponseTime = appService.ResponseTime; lr.Passed = !(result.IsErrorOccured); if (!lr.Passed) { lr.Message = result.Message; this.mFailed++; } else { lr.Message = result.SingleResult; this.mExectuedTime += lr.ResponseTime; } } catch (Exception ex) { this.mFailed++; lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; } this.mExecuted = i; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }
public static string AcquireImage(XMLParameter acq) { string psid = string.Empty; AcquisitionService acqs = new AcquisitionService(); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(1000); if (!rslAcqRVG.IsErrorOccured) { XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { // 2012-11-27/19006723: Change as the getAcquisitionResult return XML changes in Sprint 7 //int i = 0; //for (i = 0; i < getAcqRVG.MultiResults[0].Parameters.Count; i++) //{ // if (getAcqRVG.MultiResults[0].Parameters[i].ParameterName == "presentation_state_internal_id") // { // psid = getAcqRVG.MultiResults[0].Parameters[i].ParameterValue; // break; // } //} //break; PAS.AutoTest.TestUtility.ParseXMLContent parser = new PAS.AutoTest.TestUtility.ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (psIDs.Length >= 1) { psid = psIDs[0]; break; } } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { break; } } while (true); } return psid; }
//Case 1089: 1.3.7_GetPresentationStateInfo_N07_Acq image and then check the DICOM info value is correct in getPSInfo return public void Run_PS_Acq_GetPSInfo_Case1089() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); AcquisitionService acqs = new AcquisitionService(); PresentationStateService pss = new PresentationStateService(); XMLParameter acq = new XMLParameter("acq_info"); XMLParameter psa = new XMLParameter("presentationstate"); XMLParameterCollection psaCollection = new XMLParameterCollection(); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "acquire") { acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition RVG"); r.CheckPoints.Add(pAcquire); System.Diagnostics.Debug.Print("Acquire start"); XMLResult rslAcqRVG = acqs.startAcquisition(acq); System.Threading.Thread.Sleep(3000); if (rslAcqRVG.IsErrorOccured) { System.Diagnostics.Debug.Print("Acquire fail:"); pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message); } else { pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult); int DORVGcount = 0; XMLResult getAcqRVG = new XMLResult(); do { System.Threading.Thread.Sleep(3000); System.Diagnostics.Debug.Print("get acquire in do"); DORVGcount++; getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult); if (!getAcqRVG.IsErrorOccured) { string psUid = string.Empty; ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value"); string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int imageCount = imageIDs.Length; string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value"); string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int psCount = psIDs.Length; if (imageCount == 1 && psCount == 1) { pAcquire.Result = TestResult.Pass; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", getAcqRVG.ResultContent); psUid = psIDs[0]; psa.AddParameter("internal_id", psUid); XMLParameter psPreferences = new XMLParameter("preferences"); psaCollection.Add(psa); psaCollection.Add(psPreferences); XMLResult psinforeturn = pss.getPresentationStateInfo(psaCollection); CheckPoint pGetPSinfo = new CheckPoint("Get Presentation State", "PS Desc"); r.CheckPoints.Add(pGetPSinfo); for (int findvalue = 0; findvalue < psinforeturn.DicomArrayResult.Length; findvalue++) { XMLParameterNode psnode = psinforeturn.DicomArrayResult.Parameters[findvalue]; if (psnode.ParameterName == "acquired" && psnode.ParameterValue == "true") { pGetPSinfo.Result = TestResult.Pass; pGetPSinfo.Outputs.AddParameter("get presentation state", "get presentation state info as expect", "The acquired node value is true for newly acq image"); break; } } if (pGetPSinfo.Result != TestResult.Pass) { pGetPSinfo.Result = TestResult.Fail; pGetPSinfo.Outputs.AddParameter("get presentation state", "get presentation state info not as expect", "The acquired node value is NOT true for newly acq image. Actually get: " + psinforeturn.ResultContent); } } else { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", "Wrong return XML: " + getAcqRVG.ResultContent); } break; // The test case is finished, end the "do" loop } if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499) continue; if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message); } System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount); if (DORVGcount > 60) { pAcquire.Result = TestResult.Fail; pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!"); break; } } while (true); } SaveRound(r); } Output(); }
public override void Run() { string PatientStarts = string.Empty; Random random = new Random(Guid.NewGuid().GetHashCode()); PatientStarts += Convert.ToChar(random.Next(65, 91)); PatientStarts += Convert.ToChar(random.Next(65, 91)); PatientStarts += Convert.ToChar(random.Next(65, 91)); PatientStarts += Convert.ToChar(random.Next(65, 91)); PatientService ps = new PatientService(); XMLParameter pa = new XMLParameter("patient"); pa.AddParameter("patient_id", "$_R"); pa.AddParameter("dpms_id", "$_R"); pa.AddParameter("first_name", "$_R"); pa.AddParameter("last_name", "$_R"); pa.AddParameter("middle_name", "$_R"); pa.AddParameter("prefix", "Mr"); pa.AddParameter("suffix", "X"); pa.AddParameter("birth_date", "2010-10-22"); pa.AddParameter("sex", "female"); pa.AddParameter("pregnancy", "not pregnant"); pa.AddParameter("insurance_number", "1234567"); pa.AddParameter("address", "Test address"); pa.AddParameter("town", "test town"); pa.AddParameter("postal_code", "female"); pa.AddParameter("cellular_phone", "female"); pa.AddParameter("home_phone", "female"); pa.AddParameter("work_phone", "female"); pa.AddParameter("comments", "user comments"); pa.AddParameter("email", "*****@*****.**"); pa.AddParameter("photo", ""); string PatientInfo = pa.GenerateXML(); for (int i = 1; i <= this.mRepeat; i++) { LogRecordType lr = new LogRecordType(); lr.Lable = this.mLabel; lr.FunctionName = this.mFunctionName; try { XMLResult result = new XMLResult(ps.InvokeMethod("createPatient", new object[] { PatientInfo.Replace("$_R", PatientStarts + (i + 1).ToString()) })); lr.ResponseTime = ps.ResponseTime; lr.Passed = !(result.IsErrorOccured); if (!lr.Passed) { lr.Message = result.Message; this.mFailed++; } else { lr.Message = result.SingleResult; this.mExectuedTime += lr.ResponseTime; } } catch (Exception ex) { this.mFailed++; lr.Passed = false; string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message; lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")"; } this.Executed = i; Log.AddRecord(lr); this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed); } this.RiseTestCaseCompleteEvent(); }