Beispiel #1
0
        protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo method)
        {
            IEnumerable <ITestCommand> testCommands;
            StackTrace timedOutTrace;
            bool       succeded = ManualTimeout.TryExecuteWithTimeout(() => BaseEnumerateTestCommands(method), out testCommands, out timedOutTrace);

            if (!succeded)
            {
                return(ParameterGenerationTimedOutCommand.GetSingleCommand(method, timedOutTrace));
            }

            IEnumerable <CustomizingCommand> serialCommands = testCommands.Select(cmd => new CustomizingCommand(cmd));
            var repeatedCommands = Enumerable.Repeat(serialCommands, Repeat).SelectMany(s => s);

            return((!Debugger.IsAttached && Parallel) ? ParallelCommandGroup.WrapGroup(repeatedCommands) : repeatedCommands);
        }
Beispiel #2
0
        public override MethodResult Execute(object testClass)
        {
            /*
             * We have to do timeout ourselves, because xunit can't handle the fact that it's own TimeOutCommand returns exceptions with null stack traces
             * It also leaves the method executing, which hangs the build.
             */

            return(WithRetry(3, 6,
                             delegate
            {
                try
                {
                    return ManualTimeout.ExecuteWithTimeout(() => InnerCommand.Execute(testClass));
                }
                finally
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }));
        }