public void ParseArgs_AssemblyList()
        {
            string[]        input = new string[] { "cab.dll", "abc.dll", "ccb.dll" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual(3, args.AssemblyList.Count);
        }
示例#2
0
        public static int Main(string[] args)
        {
            Console.WriteLine("Parallel Test Execution Command Line Tool Version " + Assembly.GetCallingAssembly().GetName().Version.ToString());
            Console.WriteLine();

            ITestRunnerArgs testArgs = argsFactory.ParseArgs(args);

            if (!testArgs.IsValid())
            {
                PrintHelp();
                return(1);
            }

            Console.WriteLine("Starting test execution, please wait...");

            IContainer container = AutofacContainer.RegisterTypes(testArgs);

            container.Resolve <IStopwatch>().Start();
            int resultCode = 2;

            using (container.BeginLifetimeScope())
            {
                ITestRunner testRunner = container.Resolve <ITestRunner>();
                testRunner.Parse();
                testRunner.Execute();
                testRunner.WriteTrx();
                testRunner.Clean();
                resultCode = testRunner.ResultCode;
            }

            return(resultCode);
        }
        public void ParseArgs_Out()
        {
            string[]        input = new string[] { "cab.dll", "out:THE_EPIC_OUTPUT" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual("THE_EPIC_OUTPUT", args.Output);
        }
        public void ParseArgs_PLevel()
        {
            string[]        input = new string[] { "cab.dll", "plevel:testmethod" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual(PLevel.TestMethod, args.PLevel);
        }
        public void ParseArgs_Root_EndsWithSlash()
        {
            string[]        input = new string[] { "bbc.dll", "root:THE_ROOT_OF_THE_HAVEN/" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual("THE_ROOT_OF_THE_HAVEN", args.Root);
        }
        public void ParseArgs_ThreadCount()
        {
            string[]        input = new string[] { "abb.dll", "threadcount:8" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual(8, args.ThreadCount);
        }
        public void ParseArgs_Provider()
        {
            string[]        input = new string[] { "abc.dll", "provider:THE_BEST_PROVIDER_EVER" };
            ITestRunnerArgs args  = target.ParseArgs(input);

            Assert.AreEqual("THE_BEST_PROVIDER_EVER", args.Provider);
        }
示例#8
0
        public void SetUp()
        {
            target             = new TestRunnerImpl();
            args               = Stub <ITestRunnerArgs>();
            parser             = Stub <IParser>();
            cleaner            = Stub <ICleaner>();
            runDataBuilder     = Stub <IRunDataBuilder>();
            runDataListBuilder = Stub <IRunDataListBuilder>();
            executorLauncher   = Stub <IExecutorLauncher>();
            trxWriter          = Stub <ITrxWriter>();
            breaker            = Stub <IBreaker>();
            enumerator         = Stub <IRunDataEnumerator>();
            windowsFileHelper  = Stub <IWindowsFileHelper>();
            collector          = Stub <ICollector>();

            target.Args               = args;
            target.Parser             = parser;
            target.Cleaner            = cleaner;
            target.RunDataBuilder     = runDataBuilder;
            target.RunDataListBuilder = runDataListBuilder;
            target.ExecutorLauncher   = executorLauncher;
            target.TrxWriter          = trxWriter;
            target.Breaker            = breaker;
            target.Collector          = collector;
            target.WindowsFileHelper  = windowsFileHelper;
        }
示例#9
0
 public void SetUp()
 {
     args   = MockRepository.GenerateStub <ITestRunnerArgs>();
     target = new VSTestParserImpl()
     {
         Args = args
     };
 }
示例#10
0
        public Stream OpenResultFile(ITestRunnerArgs args)
        {
            if (Path.IsPathRooted(args.Output))
            {
                return(CreateFile(args.Output));
            }

            return(CreateFile(args.Root + "\\" + args.Output));
        }
        public Stream OpenResultFile(ITestRunnerArgs args)
        {
            if (Path.IsPathRooted(args.Output))
            {
                return CreateFile(args.Output);
            }

            return CreateFile(args.Root + "\\" + args.Output);
        }
        public void OpenResultFile()
        {
            ITestRunnerArgs args     = Stub <ITestRunnerArgs>();
            Stream          expected = new MemoryStream();

            windowsFileHelper.Expect((m) => m.OpenResultFile(args)).Return(expected);
            Stream actual = VerifyTarget(() => target.OpenResultFile(args));

            Assert.AreEqual(expected, actual);
        }
示例#13
0
        public void SetUp()
        {
            target        = new ExecutorLauncherImpl();
            threadFactory = Stub <IThreadFactory>();
            args          = Stub <ITestRunnerArgs>();
            executor      = Stub <IExecutor>();
            threads       = Stub <IList <IExecutorThread> >();
            thread        = Stub <IExecutorThread>();

            target.ThreadFactory = threadFactory;
            target.Args          = args;
            target.Executor      = executor;
            target.Threads       = threads;
        }
示例#14
0
        public static int Main(string[] args)
        {
            Console.WriteLine("logMe the args are : " + args.ToString());
            Console.WriteLine("Parallel Test Execution Command Line Tool Version " + Assembly.GetCallingAssembly().GetName().Version.ToString());


            ITestRunnerArgs testArgs = argsFactory.ParseArgs(args);

            Console.WriteLine("logMe the testargs are : " + testArgs.ToString());
            if (!testArgs.IsValid())
            {
                PrintHelp();
                return(1);
            }

            Console.WriteLine("logMe:  Starting test execution, please wait...");

            IContainer container = AutofacContainer.RegisterTypes(testArgs);

            Console.WriteLine("logMe: IContainer container = AutofacContainer.RegisterTypes(testArgs); the contatier is : " + container.ToString() + "   and the test args are : " + testArgs.ToString());
            container.Resolve <IStopwatch>().Start();
            Console.WriteLine("Starting container.Resolve<IStopwatch>().Start();");

            int resultCode = 2;

            using (container.BeginLifetimeScope())
            {
                ITestRunner testRunner = container.Resolve <ITestRunner>();
                Console.WriteLine("finish container.Resolve<IStopwatch>().Start();");

                Console.WriteLine("testArgs.filterCategory" + testArgs.filterCategory);
                Console.WriteLine("estArgs.filterMode" + testArgs.filterMode);

                testRunner.Parse(testArgs.filterMode, testArgs.filterCategory, testArgs.filterCategories);
                Console.WriteLine("finish  testRunner.Parse(testArgs.filterMode, testArgs.filterCategory);");
                testRunner.Execute();
                Console.WriteLine("finish  testRunner.Execute();");
                testRunner.WriteTrx();
                Console.WriteLine("finish testRunner.WriteTrx(); ");
                testRunner.Clean();
                Console.WriteLine("finish testRunner.Clean();");
                resultCode = testRunner.ResultCode;
                Console.WriteLine("finish  resultCode = testRunner.ResultCode;");
            }
            Console.WriteLine("finish  resukt code is");
            return(resultCode);
        }
示例#15
0
 public void SetUp()
 {
     args   = Stub <ITestRunnerArgs>();
     target = new RunDataBlockingBuilderImpl()
     {
         Args = args
     };
     assembly = new TestAssembly()
     {
         Name     = "THE_ASSEMBLY_PATH",
         Fixtures = new List <TestFixture>()
         {
             new TestFixture()
             {
                 Name = "Fixture2", Group = "groupA", Exclusive = false
             },
             new TestFixture()
             {
                 Name = "Fixture3", Group = null, Exclusive = false
             },
             new TestFixture()
             {
                 Name = "Fixture3A", Group = null, Exclusive = false
             },
             new TestFixture()
             {
                 Name = "Fixture1", Group = null, Exclusive = false
             },
             new TestFixture()
             {
                 Name = "Fixture3B", Group = "groupB", Exclusive = false
             },
             new TestFixture()
             {
                 Name = "Fixture4", Group = null, Exclusive = true
             },
             new TestFixture()
             {
                 Name = "Fixture2A", Group = null, Exclusive = true
             },
             new TestFixture()
             {
                 Name = "Fixture2B", Group = null, Exclusive = false
             }
         }
     };
 }
        public static IContainer RegisterTypes(ITestRunnerArgs testArgs)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(testArgs).As <ITestRunnerArgs>().SingleInstance();

            builder.RegisterType <StopwatchImpl>().As <IStopwatch>().SingleInstance();
            builder.RegisterType <TestRunnerImpl>().As <ITestRunner>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <TrxWriter>().As <ITrxWriter>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <BreakerImpl>().As <IBreaker>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <ThreadFactoryImpl>().As <IThreadFactory>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <WindowsFileHelperImpl>().As <IWindowsFileHelper>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <SummaryCalculatorImpl>().As <ISummaryCalculator>().SingleInstance().PropertiesAutowired();

            if (testArgs.Provider.StartsWith("VSTEST"))
            {
                builder.RegisterType <VSTestParserImpl>().As <IParser>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <VSTestExecutorImpl>().As <IExecutor>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <VSTestCollectorImpl>().As <ICollector>().SingleInstance().PropertiesAutowired();

                builder.RegisterType <ProcessStartInfoFactoryImpl>().As <IProcessStartInfoFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <ProcessFactoryImpl>().As <IProcessFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <ProcessOutputReaderFactoryImpl>().As <IProcessOutputReaderFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <VSTestFileHelperImpl>().As <IVSTestFileHelper>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <TrxParser>().As <ITrxParser>().SingleInstance().PropertiesAutowired();
                builder.RegisterType <VSTestCleanerImpl>().As <ICleaner>().SingleInstance().PropertiesAutowired();
            }
            else if (testArgs.Provider.StartsWith("NUNIT"))
            {
                // builder.RegisterType<NunitParserImpl>().As<IParser>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<NunitExecutorImpl>().As<IExecutor>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<NunitCollectorImpl>().As<ICollector>().SingleInstance().PropertiesAutowired();

                // builder.RegisterType<ProcessStartInfoFactoryImpl>().As<IProcessStartInfoFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<ProcessFactoryImpl>().As<IProcessFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<ProcessOutputReaderFactoryImpl>().As<IProcessOutputReaderFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<FileHelperImpl>().As<IFileHelper>().SingleInstance().PropertiesAutowired();
            }

            builder.RegisterType <RunDataBlockingBuilderImpl>().As <IRunDataBuilder>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <RunDataListBuilderImpl>().As <IRunDataListBuilder>().SingleInstance().PropertiesAutowired();
            builder.RegisterType <ExecutorLauncherImpl>().As <IExecutorLauncher>().SingleInstance().PropertiesAutowired();
            return(builder.Build());
        }
        public static IContainer RegisterTypes(ITestRunnerArgs testArgs)
        {
            var builder = new ContainerBuilder();
            builder.RegisterInstance(testArgs).As<ITestRunnerArgs>().SingleInstance();

            builder.RegisterType<StopwatchImpl>().As<IStopwatch>().SingleInstance();
            builder.RegisterType<TestRunnerImpl>().As<ITestRunner>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<TrxWriter>().As<ITrxWriter>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<BreakerImpl>().As<IBreaker>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<ThreadFactoryImpl>().As<IThreadFactory>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<WindowsFileHelperImpl>().As<IWindowsFileHelper>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<SummaryCalculatorImpl>().As<ISummaryCalculator>().SingleInstance().PropertiesAutowired();

            if (testArgs.Provider.StartsWith("VSTEST"))
            {
                builder.RegisterType<VSTestParserImpl>().As<IParser>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<VSTestExecutorImpl>().As<IExecutor>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<VSTestCollectorImpl>().As<ICollector>().SingleInstance().PropertiesAutowired();

                builder.RegisterType<ProcessStartInfoFactoryImpl>().As<IProcessStartInfoFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<ProcessFactoryImpl>().As<IProcessFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<ProcessOutputReaderFactoryImpl>().As<IProcessOutputReaderFactory>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<VSTestFileHelperImpl>().As<IVSTestFileHelper>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<TrxParser>().As<ITrxParser>().SingleInstance().PropertiesAutowired();
                builder.RegisterType<VSTestCleanerImpl>().As<ICleaner>().SingleInstance().PropertiesAutowired();
            }
            else if (testArgs.Provider.StartsWith("NUNIT"))
            {
                // builder.RegisterType<NunitParserImpl>().As<IParser>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<NunitExecutorImpl>().As<IExecutor>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<NunitCollectorImpl>().As<ICollector>().SingleInstance().PropertiesAutowired();

                // builder.RegisterType<ProcessStartInfoFactoryImpl>().As<IProcessStartInfoFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<ProcessFactoryImpl>().As<IProcessFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<ProcessOutputReaderFactoryImpl>().As<IProcessOutputReaderFactory>().SingleInstance().PropertiesAutowired();
                // builder.RegisterType<FileHelperImpl>().As<IFileHelper>().SingleInstance().PropertiesAutowired();
            }

            builder.RegisterType<RunDataBlockingBuilderImpl>().As<IRunDataBuilder>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<RunDataListBuilderImpl>().As<IRunDataListBuilder>().SingleInstance().PropertiesAutowired();
            builder.RegisterType<ExecutorLauncherImpl>().As<IExecutorLauncher>().SingleInstance().PropertiesAutowired();
            return builder.Build();
        }
 public void SetUp()
 {
     args = Stub<ITestRunnerArgs>();
     target = new RunDataBlockingBuilderImpl()
     {
         Args = args
     };
     assembly = new TestAssembly()
     {
         Name = "THE_ASSEMBLY_PATH",
         Fixtures = new List<TestFixture>()
         {
             new TestFixture() { Name = "Fixture2", Group = "groupA", Exclusive = false },
             new TestFixture() { Name = "Fixture3", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture3A", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture1", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture3B", Group = "groupB", Exclusive = false },
             new TestFixture() { Name = "Fixture4", Group = null, Exclusive = true },
             new TestFixture() { Name = "Fixture2A", Group = null, Exclusive = true },
             new TestFixture() { Name = "Fixture2B", Group = null, Exclusive = false }
         }
     };
 }
        public void SetUp()
        {
            target = new TestRunnerImpl();
            args = Stub<ITestRunnerArgs>();
            parser = Stub<IParser>();
            cleaner = Stub<ICleaner>();
            runDataBuilder = Stub<IRunDataBuilder>();
            runDataListBuilder = Stub<IRunDataListBuilder>();
            executorLauncher = Stub<IExecutorLauncher>();
            trxWriter = Stub<ITrxWriter>();
            breaker = Stub<IBreaker>();
            enumerator = Stub<IRunDataEnumerator>();
            windowsFileHelper = Stub<IWindowsFileHelper>();
            collector = Stub<ICollector>();

            target.Args = args;
            target.Parser = parser;
            target.Cleaner = cleaner;
            target.RunDataBuilder = runDataBuilder;
            target.RunDataListBuilder = runDataListBuilder;
            target.ExecutorLauncher = executorLauncher;
            target.TrxWriter = trxWriter;
            target.Breaker = breaker;
            target.Collector = collector;
            target.WindowsFileHelper = windowsFileHelper;
        }
        public void SetUp()
        {
            target = new ExecutorLauncherImpl();
            threadFactory = Stub<IThreadFactory>();
            args = Stub<ITestRunnerArgs>();
            executor = Stub<IExecutor>();
            threads = Stub<IList<IExecutorThread>>();
            thread = Stub<IExecutorThread>();

            target.ThreadFactory = threadFactory;
            target.Args = args;
            target.Executor = executor;
            target.Threads = threads;
        }
示例#21
0
 public Stream OpenResultFile(ITestRunnerArgs args)
 {
     return(WindowsFileHelper.OpenResultFile(args));
 }
 public void SetUp()
 {
     args = MockRepository.GenerateStub<ITestRunnerArgs>();
     target = new VSTestParserImpl()
     {
         Args = args
     };
 }