Ejemplo n.º 1
0
        public void RunTests()
        {
            var allMutants = _currentSession.MutantsGrouped.Cast <CheckedNode>()
                             .SelectManyRecursive(m => m.Children, leafsOnly: true).OfType <Mutant>().ToList();

            _testingProcess = _testingProcessFactory.CreateWithParams(_sessionEventsSubject, allMutants);

            foreach (var allMutant in allMutants)
            {
                var subscription = allMutant
                                   .WhenPropertyChanged(m => m.IsEquivalent)
                                   .Subscribe(equivalent => _testingProcess.MarkedAsEqivalent(equivalent));
                _subscriptions.Add(subscription);
            }


            _subscriptions.Add(
                _sessionEventsSubject.OfType <MutationScoreInfoEventArgs>()
                .Subscribe(args =>
            {
                _currentSession.MutationScore = args.MutationScore;
            }));

            new Thread(RunTestsInternal).Start();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

            // Parses the command line options to get the configuration.
            var configuration = new TesterCommandLineOptions(args).Parse();

            if (configuration.RunAsParallelBugFindingTask)
            {
                // Creates and runs a testing process.
                TestingProcess testingProcess = TestingProcess.Create(configuration);
                testingProcess.Start();
            }
            else
            {
                Output.WriteLine(". Testing " + configuration.AssemblyToBeAnalyzed);
                if (configuration.TestMethodName != "")
                {
                    Output.WriteLine("... Method {0}", configuration.TestMethodName);
                }

                // Creates and runs the testing process scheduler.
                TestingProcessScheduler.Create(configuration).Run();

                Output.WriteLine(". Done");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Runs the test specified in the configuration.
        /// </summary>
        private static void RunTest(Configuration configuration)
        {
            if (configuration.RunAsParallelBugFindingTask)
            {
                // This is being run as the child test process.
                if (configuration.ParallelDebug)
                {
                    Console.WriteLine("Attach the debugger and press ENTER to continue...");
                    Console.ReadLine();
                }

                // Load the configuration of the assembly to be tested.
                LoadAssemblyConfiguration(configuration.AssemblyToBeAnalyzed);

                TestingProcess testingProcess = TestingProcess.Create(configuration);
                testingProcess.Run();
                return;
            }

            if (configuration.ReportCodeCoverage || configuration.ReportActivityCoverage)
            {
                // This has to be here because both forms of coverage require it.
                CodeCoverageInstrumentation.SetOutputDirectory(configuration, makeHistory: true);
            }

            if (configuration.ReportCodeCoverage)
            {
                // Instruments the program under test for code coverage.
                CodeCoverageInstrumentation.Instrument(configuration);

                // Starts monitoring for code coverage.
                CodeCoverageMonitor.Start(configuration);
            }

            Console.WriteLine(". Testing " + configuration.AssemblyToBeAnalyzed);
            if (!string.IsNullOrEmpty(configuration.TestMethodName))
            {
                Console.WriteLine("... Method {0}", configuration.TestMethodName);
            }

            if (configuration.ParallelBugFindingTasks is 0)
            {
                configuration.DisableEnvironmentExit = false;
            }

            // Creates and runs the testing process scheduler.
            TestingProcessScheduler.Create(configuration).Run();
        }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

            // Parses the command line options to get the configuration.
            configuration           = new TesterCommandLineOptions(args).Parse();
            Console.CancelKeyPress += (sender, eventArgs) => CancelProcess();

#if NET46
            if (configuration.RunAsParallelBugFindingTask)
            {
                // Creates and runs a testing process.
                TestingProcess testingProcess = TestingProcess.Create(configuration);
                testingProcess.Run();
                return;
            }

            if (configuration.ReportCodeCoverage || configuration.ReportActivityCoverage)
            {
                // This has to be here because both forms of coverage require it.
                CodeCoverageInstrumentation.SetOutputDirectory(configuration, makeHistory: true);
            }

            if (configuration.ReportCodeCoverage)
            {
                // Instruments the program under test for code coverage.
                CodeCoverageInstrumentation.Instrument(configuration);

                // Starts monitoring for code coverage.
                CodeCoverageMonitor.Start(configuration);
            }
#endif

            Output.WriteLine(". Testing " + configuration.AssemblyToBeAnalyzed);
            if (!string.IsNullOrEmpty(configuration.TestMethodName))
            {
                Output.WriteLine("... Method {0}", configuration.TestMethodName);
            }

            // Creates and runs the testing process scheduler.
            TestingProcessScheduler.Create(configuration).Run();
            Shutdown();

            Output.WriteLine(". Done");
        }
Ejemplo n.º 5
0
        private static void RunTest()
        {
            if (Configuration.RunAsParallelBugFindingTask)
            {
                // This is being run as the child test process.
                if (Configuration.ParallelDebug)
                {
                    Console.WriteLine("Attach Debugger and press ENTER to continue...");
                    Console.ReadLine();
                }

                TestingProcess testingProcess = TestingProcess.Create(Configuration);
                testingProcess.Run();
                return;
            }

            if (Configuration.ReportCodeCoverage || Configuration.ReportActivityCoverage)
            {
                // This has to be here because both forms of coverage require it.
                CodeCoverageInstrumentation.SetOutputDirectory(Configuration, makeHistory: true);
            }

            if (Configuration.ReportCodeCoverage)
            {
#if NET46 || NET47
                // Instruments the program under test for code coverage.
                CodeCoverageInstrumentation.Instrument(Configuration);

                // Starts monitoring for code coverage.
                CodeCoverageMonitor.Start(Configuration);
#endif
            }

            Console.WriteLine(". Testing " + Configuration.AssemblyToBeAnalyzed);
            if (!string.IsNullOrEmpty(Configuration.TestMethodName))
            {
                Console.WriteLine("... Method {0}", Configuration.TestMethodName);
            }

            // Creates and runs the testing process scheduler.
            TestingProcessScheduler.Create(Configuration).Run();

            Console.WriteLine(". Done");
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

            // Parses the command line options to get the configuration.
            var configuration = new TesterCommandLineOptions(args).Parse();

            if (configuration.ParallelBugFindingTasks == 1 ||
                configuration.TestingProcessId < 0)
            {
                IO.PrintLine(". Testing " + configuration.AssemblyToBeAnalyzed);
                if (configuration.TestMethodName != "")
                {
                    IO.PrintLine(". Method {0}", configuration.TestMethodName);
                }
            }

            if (configuration.ParallelBugFindingTasks == 1 ||
                configuration.TestingProcessId >= 0)
            {
                // Creates and runs a testing process.
                TestingProcess testingProcess = TestingProcess.Create(configuration);
                testingProcess.Start();
            }
            else
            {
                // Creates and runs the testing process scheduler, if there
                // are more than one user specified parallel tasks.
                TestingProcessScheduler.Create(configuration).Run();
            }

            if (configuration.ParallelBugFindingTasks == 1 ||
                configuration.TestingProcessId < 0)
            {
                IO.PrintLine(". Done");
            }
        }
Ejemplo n.º 7
0
        public void RunTests()
        {
            var allMutants = _currentSession.MutantsGrouped.Cast<CheckedNode>()
                .SelectManyRecursive(m => m.Children, leafsOnly: true).OfType<Mutant>().ToList();

            _testingProcess = _testingProcessFactory.CreateWithParams(_sessionEventsSubject, allMutants);

            foreach (var allMutant in allMutants)
            {
                var subscription = allMutant
                    .WhenPropertyChanged(m => m.IsEquivalent)
                    .Subscribe(equivalent => _testingProcess.MarkedAsEqivalent(equivalent));
                _subscriptions.Add(subscription);
            }


            _subscriptions.Add(
            _sessionEventsSubject.OfType<MutationScoreInfoEventArgs>()
                .Subscribe(args =>
                {
                    _currentSession.MutationScore = args.MutationScore;
                }));

            new Thread(RunTestsInternal).Start();
        }
Ejemplo n.º 8
0
        private static void RunTest()
        {
            if (Configuration.RunAsParallelBugFindingTask)
            {
                // This is being run as the child test process.
                if (Configuration.ParallelDebug)
                {
                    Console.WriteLine("Attach Debugger and press ENTER to continue...");
                    Console.ReadLine();
                }

                // Load the configuration of the assembly to be tested.
                LoadAssemblyConfiguration(Configuration.AssemblyToBeAnalyzed);

                TestingProcess testingProcess = TestingProcess.Create(Configuration);
                testingProcess.Run();
                return;
            }

            TelemetryClient = new CoyoteTelemetryClient(Configuration);
            TelemetryClient.TrackEventAsync("test").Wait();

            if (Debugger.IsAttached)
            {
                TelemetryClient.TrackEventAsync("test-debug").Wait();
            }

            Stopwatch watch = new Stopwatch();

            watch.Start();

            if (Configuration.ReportCodeCoverage || Configuration.ReportActivityCoverage)
            {
                // This has to be here because both forms of coverage require it.
                CodeCoverageInstrumentation.SetOutputDirectory(Configuration, makeHistory: true);
            }

            if (Configuration.ReportCodeCoverage)
            {
                // Instruments the program under test for code coverage.
                CodeCoverageInstrumentation.Instrument(Configuration);

                // Starts monitoring for code coverage.
                CodeCoverageMonitor.Start(Configuration);
            }

            Console.WriteLine(". Testing " + Configuration.AssemblyToBeAnalyzed);
            if (!string.IsNullOrEmpty(Configuration.TestMethodName))
            {
                Console.WriteLine("... Method {0}", Configuration.TestMethodName);
            }

            // Creates and runs the testing process scheduler.
            int bugs = TestingProcessScheduler.Create(Configuration).Run();

            if (bugs > 0)
            {
                TelemetryClient.TrackMetricAsync("test-bugs", bugs).Wait();
            }

            Console.WriteLine(". Done");

            watch.Stop();
            if (!Debugger.IsAttached)
            {
                TelemetryClient.TrackMetricAsync("test-time", watch.Elapsed.TotalSeconds).Wait();
            }
        }