Ejemplo n.º 1
0
 public TestErrorOccuredEventArgs(ITestConfiguration configuration, ITestInformation information, Exception ex = null, ResultState state = ResultState.FAILED)
     : base(ex)
 {
     TestConfiguration = configuration;
     TestInformation   = information;
     Exception         = ex;
     ResultState       = state;
 }
Ejemplo n.º 2
0
        public static ITestInformation INewResultAfterCrashFix(this ITestInformation result)
        {
            if (result == null)
            {
                return(null);
            }

            return(NewResultAfterCrashFix(result as dynamic));
        }
Ejemplo n.º 3
0
        /***************************************************/
        /**** Private Methods - Fallback                ****/
        /***************************************************/

        private static ITestInformation NewResultAfterCrashFix(ITestInformation result)
        {
            return(new TestResult
            {
                Description = "PushPullCompare difference",
                Message = $"A previous crash in the reference has been fixed and is now showing warnings for test result information of type " + result.GetType(),
                Status = TestStatus.Warning
            });
        }
Ejemplo n.º 4
0
        public static bool IHasMatchingIDs(this ITestInformation a, ITestInformation b)
        {
            if (a == null || b == null)
            {
                return(false);
            }

            return(HasMatchingIDs(a as dynamic, b as dynamic));
        }
Ejemplo n.º 5
0
        public static ITestInformation IOnlyReferenceFound(this ITestInformation refResult)
        {
            if (refResult == null)
            {
                return(null);
            }

            return(OnlyReferenceFound(refResult as dynamic));
        }
Ejemplo n.º 6
0
        /***************************************************/
        /**** Public Methods - Interface                ****/
        /***************************************************/

        public static string IFullMessage(this ITestInformation result, int maxDepth = 3, TestStatus minSeverity = TestStatus.Pass)
        {
            if (result == null)
            {
                return("");
            }

            return(FullMessage(result as dynamic, maxDepth, minSeverity));
        }
Ejemplo n.º 7
0
        /***************************************************/
        /**** Private Methods - Fallback                ****/
        /***************************************************/

        private static ITestInformation NoReferenceFound(ITestInformation result)
        {
            return(new TestResult
            {
                Description = "PushPullCompare difference",
                Message = $"No reference results could be found for test result information of type " + result.GetType(),
                Status = oM.Test.TestStatus.Error
            });
        }
Ejemplo n.º 8
0
        /***************************************************/
        /**** Private Methods - Fallback                ****/
        /***************************************************/

        private static string FullMessage(this ITestInformation result, int maxDepth = 3, TestStatus minSeverity = TestStatus.Pass)
        {
            object ret = Base.Compute.RunExtensionMethod(result, "FullMessage", new object[] { maxDepth, minSeverity });

            if (ret != null)
            {
                return(ret.ToString());
            }
            else
            {
                return(result.Message);
            }
        }
Ejemplo n.º 9
0
        protected virtual bool RunWithTimeoutSucceeded(ITestInformation testInformation, int maxWaitTime, object targetObject, params object[] arguments)
        {
            ManualResetEvent mre = new ManualResetEvent(false);
            var method           = new Action(() => {
                testInformation.TargetMethod.Invoke(targetObject, arguments);
            });
            Thread activatorInstance = new Thread(() => {
                var iar = method.BeginInvoke(null, null);
                method.EndInvoke(iar);
                mre.Set();
            });

            activatorInstance.Start();
            var result = mre.WaitOne(maxWaitTime);

            if (activatorInstance.IsAlive)
            {
                activatorInstance.Abort();
            }
            return(result);
        }
Ejemplo n.º 10
0
 public TestInformationParserContext(ITestInformation testInformationAccessor)
 {
     Commands = new[]
     {
         new CommandInformation()
         {
             ArgumentCount         = 1,
             CommandText           = "states",
             CommandImplementation = (args, parserContextManager) =>
             {
                 parserContextManager.PushContext(new StatesParserContext(testInformationAccessor.States, "global"));
                 return(false);
             }
         },
         new CommandInformation()
         {
             ArgumentCount         = 1,
             CommandText           = "controls",
             CommandImplementation = (args, parserContextManager) =>
             {
                 parserContextManager.PushContext(new ControlsParserContext(testInformationAccessor.Controls, "global"));
                 return(false);
             }
         },
         new CommandInformation()
         {
             ArgumentCount         = 1,
             CommandText           = "actions",
             CommandImplementation = (args, parserContextManager) =>
             {
                 parserContextManager.PushContext(new ActionsParserContext(testInformationAccessor.Actions, "global"));
                 return(false);
             }
         }
     };
 }
Ejemplo n.º 11
0
        /***************************************************/
        /**** Private Methods - Fallback                ****/
        /***************************************************/

        private static bool HasMatchingIDs(this ITestInformation a, ITestInformation b)
        {
            //Different types or class not supported for the method -> false
            return(false);
        }
Ejemplo n.º 12
0
        /***************************************************/
        /**** Private Methods - Fallback                ****/
        /***************************************************/

        private static ITestInformation OnlyReferenceFound(ITestInformation result)
        {
            return(null);
        }
Ejemplo n.º 13
0
 protected virtual void ReportError(ITestConfiguration configuration, ITestInformation information, Exception ex = null, ResultState state = ResultState.FAILED)
 {
     FireDelegate(ErrorOccured, new TestErrorOccuredEventArgs(configuration, information, ex, state));
 }
Ejemplo n.º 14
0
 protected virtual bool RunSucceeded(ITestInformation testInformation, object targetObject, params object[] arguments)
 {
     testInformation.TargetMethod.Invoke(targetObject, arguments);
     return(true);
 }