public virtual bool MayProceed(TestResult result) { TestVerdict vd = result.Verdict; if (vd == TestVerdict.Pass || vd == TestVerdict.XPass || vd == TestVerdict.XFail) { return true; } return false; }
public virtual Test.Framework.TestResult Init() { DDS.ReturnCode rc; string name; string typeName; Test.Framework.TestResult result = new Test.Framework.TestResult("Initialization success" , string.Empty, TestVerdict.Pass, TestVerdict.Fail ); factory = DDS.DomainParticipantFactory.Instance; if (factory == null) { result.Result = "DomainParticipantFactory could not be initialized."; return(result); } if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok) { result.Result = "Default DomainParticipantQos could not be resolved."; return(result); } participant = factory.CreateParticipant(DDS.DomainId.Default, pqosHolder);//, null, 0); if (participant == null) { result.Result = "Creation of DomainParticipant failed."; return(result); } typeSupport = new mod.tstTypeSupport(); if (typeSupport == null) { result.Result = "Creation of tstTypeSupport failed."; return(result); } name = "my_topic"; typeName = "my_type"; rc = typeSupport.RegisterType(participant, typeName); if (rc != DDS.ReturnCode.Ok) { result.Result = "Register type failed."; return(result); } if (participant.GetDefaultTopicQos(ref topQosHolder) != DDS.ReturnCode.Ok) { result.Result = "Default TopicQos could not be resolved."; return(result); } topic = participant.CreateTopic(name, typeName, topQosHolder);//, null, 0); if (topic == null) { result.Result = "Topic could not be created."; return(result); } result.Result = "Initialization success."; result.Verdict = TestVerdict.Pass; return(null); }
public virtual Test.Framework.TestResult Init() { DDS.ReturnCode rc; string name; string typeName; Test.Framework.TestResult result = new Test.Framework.TestResult("Initialization success" , string.Empty, TestVerdict.Pass, TestVerdict.Fail ); factory = DDS.DomainParticipantFactory.Instance; if (factory == null) { result.Result = "DomainParticipantFactory could not be initialized."; return result; } if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok) { result.Result = "Default DomainParticipantQos could not be resolved."; return result; } participant = factory.CreateParticipant(string.Empty, pqosHolder);//, null, 0); if (participant == null) { result.Result = "Creation of DomainParticipant failed."; return result; } typeSupport = new mod.tstTypeSupport(); if (typeSupport == null) { result.Result = "Creation of tstTypeSupport failed."; return result; } name = "my_topic"; typeName = "my_type"; rc = typeSupport.RegisterType(participant, typeName); if (rc != DDS.ReturnCode.Ok) { result.Result = "Register type failed."; return result; } if (participant.GetDefaultTopicQos(ref topQosHolder) != DDS.ReturnCode.Ok) { result.Result = "Default TopicQos could not be resolved."; return result; } topic = participant.CreateTopic(name, typeName, topQosHolder);//, null, 0); if (topic == null) { result.Result = "Topic could not be created."; return result; } result.Result = "Initialization success."; result.Verdict = TestVerdict.Pass; return null; }
public TestResult Execute(TestFramework fw) { TestItem item; TestResult result = null; TestResult itemResult; bool proceed = true; int i; this.testFramework = fw; for (i = 0; i < preItems.Count && proceed; i++) { item = (TestItem)preItems[i]; fw.TestItem(item.title); try { itemResult = item.Run(this); fw.ItemComposeVerdict(itemResult.ExpectedVerdict, itemResult.Verdict); proceed = item.MayProceed(itemResult); } catch (System.Exception exc) { fw.TestMessage(TestMessage.Error, GetExceptionReport(exc)); itemResult = new TestResult("UNKNOWN", exc.Message, TestVerdict .Pass, TestVerdict.Fail); fw.ItemComposeVerdict(itemResult.ExpectedVerdict, itemResult.Verdict); proceed = false; } } while (i < preItems.Count) { item = (TestItem)preItems[i]; fw.TestItem(item.title); fw.ItemComposeVerdict(TestVerdict.Unresolved, TestVerdict .Unresolved); i++; } if (proceed) { try { result = this.Run(); } catch (System.Exception exc) { fw.TestMessage(TestMessage.Error, GetExceptionReport(exc)); result = new TestResult("UNKNOWN", exc.Message, TestVerdict.Pass, TestVerdict.Fail); } } else { result = new TestResult("Test succeeded", "Test could not be initialized", TestVerdict.Unresolved, TestVerdict.Unresolved); } proceed = true; for (i = 0; i < postItems.Count && proceed; i++) { item = (TestItem)postItems[i]; fw.TestItem(item.title); try { itemResult = item.Run(this); fw.ItemComposeVerdict(itemResult.ExpectedVerdict, itemResult.Verdict); proceed = item.MayProceed(itemResult); } catch (System.Exception exc) { fw.TestMessage(TestMessage.Error, GetExceptionReport(exc)); itemResult = new TestResult("UNKNOWN", exc.Message, TestVerdict.Pass, TestVerdict.Fail); fw.ItemComposeVerdict(itemResult.ExpectedVerdict, itemResult.Verdict); proceed = false; } } if (i < postItems.Count) { result.Verdict = TestVerdict.Unresolved; } while (i < postItems.Count) { item = (TestItem)postItems[i]; fw.TestItem(item.title); fw.ItemComposeVerdict(TestVerdict.Unresolved, TestVerdict.Unresolved); i++; } return result; }
public virtual Test.Framework.TestResult Test() { Test.Framework.TestResult result; string sh; DDS.ReturnCode rc; DDS.ErrorInfo errInfo = new DDS.ErrorInfo(); rc = factory.DeleteParticipant(participant); if (rc != DDS.ReturnCode.Ok) { if (rc != DDS.ReturnCode.PreconditionNotMet) { return(new Test.Framework.TestResult("Returncode did not match PreconditionNotMet" , "Got returncode: " + rc + " expected PreconditionNotMet(4)", TestVerdict.Pass, TestVerdict.Fail)); } if (errInfo.Update() != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("Update returns OK after the error occurred" , "Update did not return OK after the error occurred", TestVerdict.Pass, TestVerdict.Fail)); } rc = errInfo.GetLocation(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_location returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Location: " + sh); sh = null; rc = errInfo.GetMessage(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_message returns OK and modifies string" , "Different result and/or string modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Message: " + sh); sh = null; rc = errInfo.GetStackTrace(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_stack_trace returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Stack trace: " + sh); sh = null; rc = errInfo.GetSourceLine(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_source_line returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Source line: " + sh); result = new Test.Framework.TestResult("sacs_errorinfo_tc2 successfull", "sacs_errorinfo_tc2_successfull", TestVerdict.Pass, TestVerdict.Pass); } else { result = new Test.Framework.TestResult("delete_participant should fail", "delete_participant did not fail", TestVerdict.Pass, TestVerdict.Fail); } return(result); }
public virtual Test.Framework.TestResult Test() { Test.Framework.TestResult result; string sh; DDS.ErrorCode eh; DDS.ReturnCode rc; rc = factory.DeleteParticipant(participant); if (rc != DDS.ReturnCode.Ok) { if (DDS.ErrorInfo.Update() != DDS.ReturnCode.Ok) { return new Test.Framework.TestResult("Update returns OK after the error occurred" , "Update did not return OK after the error occurred", TestVerdict.Pass, TestVerdict.Fail); } rc = DDS.ErrorInfo.GetLocation(out sh); if (rc != DDS.ReturnCode.Ok) { return new Test.Framework.TestResult("get_location returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail); } System.Console.WriteLine("Location: " + sh); sh = null; rc = DDS.ErrorInfo.GetMessage(out sh); if (rc != DDS.ReturnCode.Ok) { return new Test.Framework.TestResult("get_message returns OK and modifies string" , "Different result and/or string modified", TestVerdict.Pass, TestVerdict.Fail); } System.Console.WriteLine("Message: " + sh); sh = null; rc = DDS.ErrorInfo.GetStackTrace(out sh); if (rc != DDS.ReturnCode.Ok) { return new Test.Framework.TestResult("get_stack_trace returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail); } System.Console.WriteLine("Stack trace: " + sh); sh = null; rc = DDS.ErrorInfo.GetSourceLine(out sh); if (rc != DDS.ReturnCode.Ok) { return new Test.Framework.TestResult("get_source_line returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail); } System.Console.WriteLine("Source line: " + sh); eh = (DDS.ErrorCode)(-1); rc = DDS.ErrorInfo.GetCode(out eh); if ((rc != DDS.ReturnCode.Ok) || (eh == (DDS.ErrorCode)(-1))) { return new Test.Framework.TestResult("get_code returns OK and does modify error code" , "Different result and/or error code not modified", TestVerdict.Pass, TestVerdict.Fail); } System.Console.WriteLine("Returncode: " + rc); System.Console.WriteLine("Error code: " + eh); if (eh != DDS.ErrorCode.ContainsEntities) { return new Test.Framework.TestResult("Expected errorcode " + DDS.ErrorCode.ContainsEntities, "Obtained errorcode " + eh, TestVerdict.Pass, TestVerdict.Fail); } result = new Test.Framework.TestResult("sacs_errorinfo_tc2 successfull", "sacs_errorinfo_tc2_successfull", TestVerdict.Pass, TestVerdict.Pass); } else { result = new Test.Framework.TestResult("delete_participant should fail", "delete_participant did not fail", TestVerdict.Pass, TestVerdict.Fail); } return result; }
public virtual Test.Framework.TestResult Test() { Test.Framework.TestResult result; string sh; DDS.ErrorCode eh; DDS.ReturnCode rc; rc = factory.DeleteParticipant(participant); if (rc != DDS.ReturnCode.Ok) { if (DDS.ErrorInfo.Update() != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("Update returns OK after the error occurred" , "Update did not return OK after the error occurred", TestVerdict.Pass, TestVerdict.Fail)); } rc = DDS.ErrorInfo.GetLocation(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_location returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Location: " + sh); sh = null; rc = DDS.ErrorInfo.GetMessage(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_message returns OK and modifies string" , "Different result and/or string modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Message: " + sh); sh = null; rc = DDS.ErrorInfo.GetStackTrace(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_stack_trace returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Stack trace: " + sh); sh = null; rc = DDS.ErrorInfo.GetSourceLine(out sh); if (rc != DDS.ReturnCode.Ok) { return(new Test.Framework.TestResult("get_source_line returns OK and modifies string" , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Source line: " + sh); eh = (DDS.ErrorCode)(-1); rc = DDS.ErrorInfo.GetCode(out eh); if ((rc != DDS.ReturnCode.Ok) || (eh == (DDS.ErrorCode)(-1))) { return(new Test.Framework.TestResult("get_code returns OK and does modify error code" , "Different result and/or error code not modified", TestVerdict.Pass, TestVerdict.Fail)); } System.Console.WriteLine("Returncode: " + rc); System.Console.WriteLine("Error code: " + eh); if (eh != DDS.ErrorCode.ContainsEntities) { return(new Test.Framework.TestResult("Expected errorcode " + DDS.ErrorCode.ContainsEntities, "Obtained errorcode " + eh, TestVerdict.Pass, TestVerdict.Fail)); } result = new Test.Framework.TestResult("sacs_errorinfo_tc2 successfull", "sacs_errorinfo_tc2_successfull", TestVerdict.Pass, TestVerdict.Pass); } else { result = new Test.Framework.TestResult("delete_participant should fail", "delete_participant did not fail", TestVerdict.Pass, TestVerdict.Fail); } return(result); }