Ejemplo n.º 1
0
        /// <summary>
        /// Analyses the arguments and displays an interface to the user. Kicks off the program.
        /// </summary>
        /// <param name="args">User input</param>
        public int Run(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name             = "Stryker",
                FullName         = "Stryker: Stryker mutator for .Net",
                Description      = "Stryker mutator for .Net",
                ExtendedHelpText = "Welcome to Stryker for .Net! Run dotnet stryker to kick off a mutation test run"
            };

            var configFilePathParam           = CreateOption(app, CLIOptions.ConfigFilePath);
            var reporterParam                 = CreateOption(app, CLIOptions.Reporters);
            var logConsoleParam               = CreateOption(app, CLIOptions.LogLevel);
            var devMode                       = CreateOption(app, CLIOptions.DevMode);
            var coverageAnalysis              = CreateOption(app, CLIOptions.CoverageAnalysis);
            var advancedOptions               = CreateOption(app, CLIOptions.AbortOnFailTest);
            var timeoutParam                  = CreateOption(app, CLIOptions.AdditionalTimeoutMS);
            var exludedMutationsParam         = CreateOption(app, CLIOptions.ExcludedMutations);
            var fileLogParam                  = CreateOption(app, CLIOptions.LogToFile);
            var projectNameParam              = CreateOption(app, CLIOptions.ProjectFileName);
            var maxConcurrentTestRunnersParam = CreateOption(app, CLIOptions.MaxConcurrentTestRunners);
            var thresholdHighParam            = CreateOption(app, CLIOptions.ThresholdHigh);
            var thresholdLowParam             = CreateOption(app, CLIOptions.ThresholdLow);
            var thresholdBreakParam           = CreateOption(app, CLIOptions.ThresholdBreak);
            var filesToExclude                = CreateOption(app, CLIOptions.FilesToExclude);
            var testRunner                    = CreateOption(app, CLIOptions.TestRunner);
            var solutionPathParam             = CreateOption(app, CLIOptions.SolutionPath);

            app.HelpOption("--help | -h | -?");

            app.OnExecute(() =>
            {
                // app started
                var options = new OptionsBuilder().Build(
                    Directory.GetCurrentDirectory(),
                    reporterParam,
                    projectNameParam,
                    timeoutParam,
                    exludedMutationsParam,
                    logConsoleParam,
                    fileLogParam,
                    devMode,
                    coverageAnalysis,
                    advancedOptions,
                    configFilePathParam,
                    maxConcurrentTestRunnersParam,
                    thresholdHighParam,
                    thresholdLowParam,
                    thresholdBreakParam,
                    filesToExclude,
                    testRunner,
                    solutionPathParam);

                RunStryker(options);
                return(ExitCode);
            });
            return(app.Execute(args));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Analyses the arguments and displays an interface to the user. Kicks off the program.
        /// </summary>
        /// <param name="args">User input</param>
        public void Run(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name             = "StrykerNet",
                FullName         = "StrykerNet: Stryker mutator for .Net Core",
                Description      = "Stryker mutator for .Net Core",
                ExtendedHelpText = "Welcome to StrykerNet for .Net Core. Run dotnet stryker to kick off a mutation test run"
            };

            var configFilePathParam = app.Option($"{CLIOptions.ConfigFilePath.ArgumentName} | {CLIOptions.ConfigFilePath.ArgumentShortName}",
                                                 CLIOptions.ConfigFilePath.ArgumentDescription,
                                                 CommandOptionType.SingleValue);

            var reporterParam = app.Option($"{CLIOptions.Reporter.ArgumentName} | {CLIOptions.Reporter.ArgumentShortName}",
                                           CLIOptions.Reporter.ArgumentDescription,
                                           CommandOptionType.SingleValue);

            var logConsoleParam = app.Option($"{CLIOptions.LogLevel.ArgumentName} | {CLIOptions.LogLevel.ArgumentShortName}",
                                             CLIOptions.LogLevel.ArgumentDescription,
                                             CommandOptionType.SingleValue);

            var timeoutParam = app.Option($"{CLIOptions.AdditionalTimeoutMS.ArgumentName} | {CLIOptions.AdditionalTimeoutMS.ArgumentShortName}",
                                          CLIOptions.AdditionalTimeoutMS.ArgumentDescription,
                                          CommandOptionType.SingleValue);

            var fileLogParam = app.Option($"{CLIOptions.UseLogLevelFile.ArgumentName} | {CLIOptions.UseLogLevelFile.ArgumentShortName}",
                                          CLIOptions.UseLogLevelFile.ArgumentDescription,
                                          CommandOptionType.SingleValue);

            var projectNameParam = app.Option($"{CLIOptions.ProjectFileName.ArgumentName} | {CLIOptions.ProjectFileName.ArgumentShortName}",
                                              CLIOptions.ProjectFileName.ArgumentDescription,
                                              CommandOptionType.SingleValue);

            var maxConcurrentTestRunnersParam = app.Option($"{CLIOptions.MaxConcurrentTestRunners.ArgumentName} | {CLIOptions.MaxConcurrentTestRunners.ArgumentShortName}",
                                                           CLIOptions.MaxConcurrentTestRunners.ArgumentDescription,
                                                           CommandOptionType.SingleValue);

            app.HelpOption("--help | -h | -?");

            app.OnExecute(() => {
                // app started
                var options = new OptionsBuilder().Build(
                    Directory.GetCurrentDirectory(),
                    reporterParam,
                    projectNameParam,
                    timeoutParam,
                    logConsoleParam,
                    fileLogParam,
                    configFilePathParam,
                    maxConcurrentTestRunnersParam);

                return(RunStryker(options));
            });

            app.Execute(args);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Analyses the arguments and displays an interface to the user. Kicks off the program.
        /// </summary>
        /// <param name="args">User input</param>
        public int Run(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name             = "StrykerNet",
                FullName         = "StrykerNet: Stryker mutator for .Net Core",
                Description      = "Stryker mutator for .Net Core",
                ExtendedHelpText = "Welcome to StrykerNet for .Net Core. Run dotnet stryker to kick off a mutation test run"
            };

            var configFilePathParam           = CreateOption(app, CLIOptions.ConfigFilePath);
            var reporterParam                 = CreateOption(app, CLIOptions.Reporter);
            var logConsoleParam               = CreateOption(app, CLIOptions.LogLevel);
            var timeoutParam                  = CreateOption(app, CLIOptions.AdditionalTimeoutMS);
            var fileLogParam                  = CreateOption(app, CLIOptions.UseLogLevelFile);
            var projectNameParam              = CreateOption(app, CLIOptions.ProjectFileName);
            var maxConcurrentTestRunnersParam = CreateOption(app, CLIOptions.MaxConcurrentTestRunners);
            var thresholdHighParam            = CreateOption(app, CLIOptions.ThresholdHigh);
            var thresholdLowParam             = CreateOption(app, CLIOptions.ThresholdLow);
            var thresholdBreakParam           = CreateOption(app, CLIOptions.ThresholdBreak);

            app.HelpOption("--help | -h | -?");

            app.OnExecute(() => {
                // app started
                var options = new OptionsBuilder().Build(
                    Directory.GetCurrentDirectory(),
                    reporterParam,
                    projectNameParam,
                    timeoutParam,
                    logConsoleParam,
                    fileLogParam,
                    configFilePathParam,
                    maxConcurrentTestRunnersParam,
                    thresholdHighParam,
                    thresholdLowParam,
                    thresholdBreakParam
                    );
                RunStryker(options);
                return(this.ExitCode);
            });
            return(app.Execute(args));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Analyses the arguments and displays an interface to the user. Kicks off the program.
        /// </summary>
        /// <param name="args">User input</param>
        public int Run(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name             = "Stryker",
                FullName         = "Stryker: Stryker mutator for .Net",
                Description      = "Stryker mutator for .Net",
                ExtendedHelpText = "Welcome to Stryker for .Net! Run dotnet stryker to kick off a mutation test run"
            };

            var configFilePathParam          = CreateOption(app, CLIOptions.ConfigFilePath);
            var reporterParam                = CreateOption(app, CLIOptions.Reporters);
            var dashboardApiKeyParam         = CreateOption(app, CLIOptions.DashboardApiKeyOption);
            var reportersProjectNameParam    = CreateOption(app, CLIOptions.DashboardProjectNameOption);
            var reportersModuleNameParam     = CreateOption(app, CLIOptions.DashboardModuleNameOption);
            var reportersProjectVersionParam = CreateOption(app, CLIOptions.DashboardProjectVersionOption);
            var logConsoleParam              = CreateOption(app, CLIOptions.LogLevel);
            var devMode                       = CreateOption(app, CLIOptions.DevMode);
            var coverageAnalysis              = CreateOption(app, CLIOptions.CoverageAnalysis);
            var abortTestOnFailParam          = CreateOption(app, CLIOptions.AbortTestOnFail);
            var disableSimultaneousTesting    = CreateOption(app, CLIOptions.DisableTestingMix);
            var timeoutParam                  = CreateOption(app, CLIOptions.AdditionalTimeoutMS);
            var excludedMutationsParam        = CreateOption(app, CLIOptions.ExcludedMutations);
            var ignoreMethodsParam            = CreateOption(app, CLIOptions.IgnoreMethods);
            var fileLogParam                  = CreateOption(app, CLIOptions.LogToFile);
            var projectNameParam              = CreateOption(app, CLIOptions.ProjectFileName);
            var maxConcurrentTestRunnersParam = CreateOption(app, CLIOptions.MaxConcurrentTestRunners);
            var thresholdHighParam            = CreateOption(app, CLIOptions.ThresholdHigh);
            var thresholdLowParam             = CreateOption(app, CLIOptions.ThresholdLow);
            var thresholdBreakParam           = CreateOption(app, CLIOptions.ThresholdBreak);
            var filesToExclude                = CreateOption(app, CLIOptions.FilesToExclude);
            var mutateParam                   = CreateOption(app, CLIOptions.Mutate);
            var testRunner                    = CreateOption(app, CLIOptions.TestRunner);
            var solutionPathParam             = CreateOption(app, CLIOptions.SolutionPath);
            var languageVersion               = CreateOption(app, CLIOptions.LanguageVersionOption);
            var diffParam                     = CreateOption(app, CLIOptions.Diff);
            var gitSourceParam                = CreateOption(app, CLIOptions.GitSource);
            var testProjectsParam             = CreateOption(app, CLIOptions.TestProjects);
            var msBuildArgumentsParam         = CreateOption(app, CLIOptions.MsBuildArguments);

            app.HelpOption("--help | -h | -?");

            app.OnExecute(() =>
            {
                // app started
                var options = new OptionsBuilder(_logBuffer).Build(
                    basePath: Directory.GetCurrentDirectory(),
                    reporter: reporterParam,
                    dashboardApiKey: dashboardApiKeyParam,
                    reportersProjectName: reportersProjectNameParam,
                    reportersModuleName: reportersModuleNameParam,
                    reportersProjectVersion: reportersProjectVersionParam,
                    projectUnderTestNameFilter: projectNameParam,
                    additionalTimeoutMS: timeoutParam,
                    excludedMutations: excludedMutationsParam,
                    ignoreMethods: ignoreMethodsParam,
                    logLevel: logConsoleParam,
                    logToFile: fileLogParam,
                    devMode: devMode,
                    coverageAnalysis: coverageAnalysis,
                    abortTestOnFail: abortTestOnFailParam,
                    configFilePath: configFilePathParam,
                    disableSimultaneousTesting: disableSimultaneousTesting,
                    maxConcurrentTestRunners: maxConcurrentTestRunnersParam,
                    thresholdHigh: thresholdHighParam,
                    thresholdLow: thresholdLowParam,
                    thresholdBreak: thresholdBreakParam,
                    filesToExclude: filesToExclude,
                    filePatterns: mutateParam,
                    testRunner: testRunner,
                    solutionPath: solutionPathParam,
                    languageVersion: languageVersion,
                    diff: diffParam,
                    gitSource: gitSourceParam,
                    testProjects: testProjectsParam,
                    msBuildArguments: msBuildArgumentsParam);

                RunStryker(options);
                return(ExitCode);
            });
            return(app.Execute(args));
        }