Пример #1
0
 public StrykerOptions(string basePath    = "",
                       string[] reporters = null,
                       string projectUnderTestNameFilter = "",
                       int additionalTimeoutMS           = 30000,
                       string[] excludedMutations        = null,
                       string logLevel = "info",
                       bool logToFile  = false,
                       bool devMode    = false,
                       int maxConcurrentTestRunners = int.MaxValue,
                       int thresholdHigh            = 80,
                       int thresholdLow             = 60,
                       int thresholdBreak           = 0,
                       string[] filesToExclude      = null,
                       string testRunner            = "dotnettest")
 {
     BasePath  = basePath;
     Reporters = ValidateReporters(reporters);
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     ExcludedMutations          = ValidateExludedMutations(excludedMutations);
     LogOptions            = new LogOptions(ValidateLogLevel(logLevel), logToFile);
     DevMode               = devMode;
     ConcurrentTestrunners = ValidateConcurrentTestrunners(maxConcurrentTestRunners);
     ThresholdOptions      = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
     FilesToExclude        = ValidateFilesToExclude(filesToExclude);
     TestRunner            = ValidateTestRunner(testRunner);
 }
Пример #2
0
        public StrykerOptions(
            ILogger logger                    = null,
            IFileSystem fileSystem            = null,
            string basePath                   = "",
            string[] reporters                = null,
            string projectUnderTestNameFilter = "",
            int additionalTimeoutMS           = 5000,
            string[] excludedMutations        = null,
            string[] ignoredMethods           = null,
            string logLevel                   = "info",
            bool logToFile                    = false,
            bool devMode                    = false,
            string coverageAnalysis         = "perTest",
            bool abortTestOnFail            = true,
            bool disableSimultaneousTesting = false,
            int?maxConcurrentTestRunners    = null,
            int thresholdHigh               = 80,
            int thresholdLow                = 60,
            int thresholdBreak              = 0,
            string[] filesToExclude         = null,
            string[] mutate                 = null,
            string testRunner               = "vstest",
            string solutionPath             = null,
            string languageVersion          = "latest",
            bool diff                         = false,
            string gitSource                  = "master",
            string dashboadApiKey             = null,
            string projectName                = null,
            string moduleName                 = null,
            string projectVersion             = null,
            IEnumerable <string> testProjects = null)
        {
            _logger     = logger;
            _fileSystem = fileSystem ?? new FileSystem();

            var outputPath = ValidateOutputPath(basePath);

            IgnoredMethods             = ValidateIgnoredMethods(ignoredMethods ?? Array.Empty <string>());
            BasePath                   = basePath;
            OutputPath                 = outputPath;
            Reporters                  = ValidateReporters(reporters);
            ProjectUnderTestNameFilter = projectUnderTestNameFilter;
            AdditionalTimeoutMS        = additionalTimeoutMS;
            ExcludedMutations          = ValidateExcludedMutations(excludedMutations);
            LogOptions                 = new LogOptions(ValidateLogLevel(logLevel), logToFile, outputPath);
            DevMode = devMode;
            ConcurrentTestrunners = ValidateConcurrentTestrunners(maxConcurrentTestRunners);
            Optimizations         = ValidateMode(coverageAnalysis) | (abortTestOnFail ? OptimizationFlags.AbortTestOnKill : 0) | (disableSimultaneousTesting ? OptimizationFlags.DisableTestMix : 0);
            Thresholds            = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
            FilePatterns          = ValidateFilePatterns(mutate, filesToExclude);
            TestRunner            = ValidateTestRunner(testRunner);
            SolutionPath          = ValidateSolutionPath(basePath, solutionPath);
            LanguageVersion       = ValidateLanguageVersion(languageVersion);
            OptimizationMode      = coverageAnalysis;
            DiffEnabled           = diff;
            GitSource             = ValidateGitSource(gitSource);
            TestProjects          = ValidateTestProjects(testProjects);
            (DashboardApiKey, ProjectName, ModuleName, ProjectVersion) = ValidateDashboardReporter(dashboadApiKey, projectName, moduleName, projectVersion);
        }
Пример #3
0
 public StrykerOptions(string basePath, string reporter, string projectUnderTestNameFilter, int additionalTimeoutMS, string logLevel, bool logToFile)
 {
     BasePath = basePath;
     Reporter = ValidateReporter(reporter);
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     LogOptions = new LogOptions(logLevel, logToFile);
 }
Пример #4
0
 public StrykerOptions(string basePath, string reporter, string projectUnderTestNameFilter, int additionalTimeoutMS, string logLevel, bool logToFile,
                       int maxConcurrentTestRunners)
 {
     BasePath = basePath;
     Reporter = ValidateReporter(reporter);
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     LogOptions = new LogOptions(ValidateLogLevel(logLevel), logToFile);
     MaxConcurrentTestrunners = ValidateMaxConcurrentTestrunners(maxConcurrentTestRunners);
 }
Пример #5
0
 public StrykerOptions(string basePath,
                       string reporter,
                       string projectUnderTestNameFilter,
                       LogOptions logOptions           = null,
                       ICollection <IMutator> mutators = null)
 {
     BasePath = basePath;
     Reporter = reporter;
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     Mutators   = mutators;
     LogOptions = logOptions ?? new LogOptions(null, false);
 }
Пример #6
0
 private StrykerOptions(
     string basePath,
     string outputPath,
     IEnumerable <Reporter> reporters,
     string projectUnderTestNameFilter,
     string projectUnderTest,
     int additionalTimeoutMS,
     IEnumerable <Mutator> excludedMutations,
     IEnumerable <Regex> ignoredMethods,
     LogOptions logOptions,
     OptimizationFlags optimizations,
     Threshold thresholds,
     bool devMode,
     string optimizationMode,
     int concurrentTestRunners,
     IEnumerable <FilePattern> filePatterns,
     TestRunner testRunner,
     string solutionPath,
     LanguageVersion languageVersion,
     string gitDiffSource,
     IEnumerable <string> testProjects,
     string azureSAS,
     string azureFileStorageUrl,
     BaselineProvider baselineProvider,
     MutationLevel mutationLevel)
 {
     IgnoredMethods             = ignoredMethods;
     BasePath                   = basePath;
     OutputPath                 = outputPath;
     Reporters                  = reporters;
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     ProjectUnderTest           = projectUnderTest;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     ExcludedMutations          = excludedMutations;
     LogOptions                 = logOptions;
     DevMode = devMode;
     ConcurrentTestrunners = concurrentTestRunners;
     Thresholds            = thresholds;
     FilePatterns          = filePatterns;
     TestRunner            = testRunner;
     SolutionPath          = solutionPath;
     LanguageVersion       = languageVersion;
     OptimizationMode      = optimizationMode;
     Optimizations         = optimizations;
     GitDiffTarget         = gitDiffSource;
     TestProjects          = testProjects;
     AzureSAS            = azureSAS;
     AzureFileStorageUrl = azureFileStorageUrl;
     BaselineProvider    = baselineProvider;
     MutationLevel       = mutationLevel;
 }
Пример #7
0
        public StrykerOptions(
            IFileSystem fileSystem            = null,
            string basePath                   = "",
            string[] reporters                = null,
            string projectUnderTestNameFilter = "",
            string testProjectNameFilter      = "*.csproj",
            int additionalTimeoutMS           = 5000,
            string[] excludedMutations        = null,
            string[] ignoredMethods           = null,
            string logLevel                   = "info",
            bool logToFile               = false,
            bool devMode                 = false,
            string coverageAnalysis      = "perTest",
            bool abortTestOnFail         = true,
            int maxConcurrentTestRunners = int.MaxValue,
            int thresholdHigh            = 80,
            int thresholdLow             = 60,
            int thresholdBreak           = 0,
            string[] filesToExclude      = null,
            string[] mutate              = null,
            string testRunner            = "vstest",
            string solutionPath          = null,
            string languageVersion       = "latest",
            bool diff        = false,
            string gitSource = "master")
        {
            _fileSystem = fileSystem ?? new FileSystem();

            var outputPath = ValidateOutputPath(basePath);

            IgnoredMethods             = ValidateIgnoredMethods(ignoredMethods ?? Array.Empty <string>());
            BasePath                   = basePath;
            OutputPath                 = outputPath;
            Reporters                  = ValidateReporters(reporters);
            ProjectUnderTestNameFilter = projectUnderTestNameFilter;
            TestProjectNameFilter      = ValidateTestProjectFilter(basePath, testProjectNameFilter);
            AdditionalTimeoutMS        = additionalTimeoutMS;
            ExcludedMutations          = ValidateExcludedMutations(excludedMutations);
            LogOptions                 = new LogOptions(ValidateLogLevel(logLevel), logToFile, outputPath);
            DevMode = devMode;
            ConcurrentTestrunners = ValidateConcurrentTestrunners(maxConcurrentTestRunners);
            Optimizations         = ValidateMode(coverageAnalysis) | (abortTestOnFail ? OptimizationFlags.AbortTestOnKill : OptimizationFlags.NoOptimization);
            Thresholds            = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
            FilePatterns          = ValidateFilePatterns(mutate, filesToExclude);
            TestRunner            = ValidateTestRunner(testRunner);
            SolutionPath          = ValidateSolutionPath(basePath, solutionPath);
            LanguageVersion       = ValidateLanguageVersion(languageVersion);
            OptimizationMode      = coverageAnalysis;
            DiffEnabled           = diff;
            GitSource             = ValidateGitSource(gitSource);
        }
Пример #8
0
 public StrykerOptions(string basePath,
                       string reporter,
                       string projectUnderTestNameFilter,
                       int additionalTimeoutMS,
                       string[] excludedMutations,
                       string logLevel,
                       bool logToFile,
                       int maxConcurrentTestRunners,
                       int thresholdHigh,
                       int thresholdLow,
                       int thresholdBreak)
 {
     BasePath = basePath;
     Reporter = ValidateReporter(reporter);
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     ExcludedMutations          = ValidateExludedMutations(excludedMutations);
     LogOptions = new LogOptions(ValidateLogLevel(logLevel), logToFile);
     MaxConcurrentTestrunners = ValidateMaxConcurrentTestrunners(maxConcurrentTestRunners);
     ThresholdOptions         = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
 }
Пример #9
0
        public StrykerOptions(
            IFileSystem fileSystem            = null,
            string basePath                   = "",
            string[] reporters                = null,
            string projectUnderTestNameFilter = "",
            int additionalTimeoutMS           = 5000,
            string[] excludedMutations        = null,
            string logLevel                   = "info",
            bool logToFile               = false,
            bool devMode                 = false,
            string coverageAnalysis      = "",
            bool abortOnFail             = false,
            int maxConcurrentTestRunners = int.MaxValue,
            int thresholdHigh            = 80,
            int thresholdLow             = 60,
            int thresholdBreak           = 0,
            string[] filesToExclude      = null,
            string testRunner            = "dotnettest",
            string solutionPath          = null)
        {
            _fileSystem = fileSystem ?? new FileSystem();

            var outputPath = ValidateOutputPath(basePath);

            BasePath   = basePath;
            OutputPath = outputPath;
            Reporters  = ValidateReporters(reporters);
            ProjectUnderTestNameFilter = projectUnderTestNameFilter;
            AdditionalTimeoutMS        = additionalTimeoutMS;
            ExcludedMutations          = ValidateExludedMutations(excludedMutations);
            LogOptions            = new LogOptions(ValidateLogLevel(logLevel), logToFile, outputPath);
            DevMode               = devMode;
            ConcurrentTestrunners = ValidateConcurrentTestrunners(maxConcurrentTestRunners);
            Optimizations         = ValidateMode(coverageAnalysis) | (abortOnFail ? OptimizationFlags.AbortTestOnKill : OptimizationFlags.NoOptimization);
            Thresholds            = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
            FilesToExclude        = ValidateFilesToExclude(filesToExclude);
            TestRunner            = ValidateTestRunner(testRunner);
            SolutionPath          = ValidateSolutionPath(basePath, solutionPath);
        }
Пример #10
0
 private StrykerOptions(
     IFileSystem fileSystem,
     ILogger logger,
     string basePath,
     string outputPath,
     IEnumerable <Reporter> reporters,
     string projectUnderTestNameFilter,
     string projectUnderTest,
     int additionalTimeoutMS,
     IEnumerable <Mutator> excludedMutations,
     IEnumerable <Regex> ignoredMethods,
     LogOptions logOptions,
     OptimizationFlags optimizations,
     Threshold thresholds,
     bool devMode,
     string optimizationMode,
     int concurrentTestRunners,
     IEnumerable <FilePattern> filePatterns,
     TestRunner testRunner,
     string solutionPath,
     LanguageVersion languageVersion,
     bool diffEnabled,
     string gitDiffSource,
     IEnumerable <FilePattern> diffIgnoreFiles,
     IEnumerable <string> testProjects,
     string azureSAS,
     string azureFileStorageUrl,
     BaselineProvider baselineProvider,
     MutationLevel mutationLevel,
     bool compareToDashboard,
     string dashboardUrl,
     string dashboardApiKey,
     string projectName,
     string moduleName,
     string projectVersion,
     string fallbackVersion)
 {
     _fileSystem                = fileSystem;
     _logger                    = logger;
     IgnoredMethods             = ignoredMethods;
     BasePath                   = basePath;
     OutputPath                 = outputPath;
     Reporters                  = reporters;
     ProjectUnderTestNameFilter = projectUnderTestNameFilter;
     ProjectUnderTest           = projectUnderTest;
     AdditionalTimeoutMS        = additionalTimeoutMS;
     ExcludedMutations          = excludedMutations;
     LogOptions                 = logOptions;
     DevMode                    = devMode;
     ConcurrentTestrunners      = concurrentTestRunners;
     Thresholds                 = thresholds;
     FilePatterns               = filePatterns;
     TestRunner                 = testRunner;
     SolutionPath               = solutionPath;
     LanguageVersion            = languageVersion;
     OptimizationMode           = optimizationMode;
     Optimizations              = optimizations;
     DiffEnabled                = diffEnabled;
     GitDiffSource              = gitDiffSource;
     DiffIgnoreFiles            = diffIgnoreFiles;
     TestProjects               = testProjects;
     AzureSAS                   = azureSAS;
     AzureFileStorageUrl        = azureFileStorageUrl;
     BaselineProvider           = baselineProvider;
     MutationLevel              = mutationLevel;
     CompareToDashboard         = compareToDashboard;
     DashboardUrl               = dashboardUrl;
     DashboardApiKey            = dashboardApiKey;
     ProjectName                = projectName;
     ModuleName                 = moduleName;
     ProjectVersion             = projectVersion;
     FallbackVersion            = fallbackVersion;
 }
Пример #11
0
        public StrykerOptions(
            ILogger logger                    = null,
            IFileSystem fileSystem            = null,
            string basePath                   = "",
            string[] reporters                = null,
            string projectUnderTestNameFilter = "",
            int additionalTimeoutMS           = 5000,
            string[] excludedMutations        = null,
            string[] ignoredMethods           = null,
            string logLevel                   = "info",
            bool logToFile                    = false,
            bool devMode                    = false,
            string coverageAnalysis         = "perTest",
            bool abortTestOnFail            = true,
            bool disableSimultaneousTesting = false,
            int?maxConcurrentTestRunners    = null,
            int thresholdHigh               = 80,
            int thresholdLow                = 60,
            int thresholdBreak              = 0,
            string[] filesToExclude         = null,
            string[] mutate                 = null,
            string testRunner               = "vstest",
            string solutionPath             = null,
            string languageVersion          = "latest",
            bool diff = false,
            bool compareToDashboard        = false,
            string gitDiffTarget           = "master",
            string dashboardApiKey         = null,
            string dashboardUrl            = "https://dashboard.stryker-mutator.io",
            string projectName             = null,
            string moduleName              = null,
            string projectVersion          = null,
            string fallbackVersion         = null,
            string baselineStorageLocation = null,
            string azureSAS                   = null,
            string azureFileStorageUrl        = null,
            IEnumerable <string> testProjects = null,
            string mutationLevel              = null,
            string[] diffIgnoreFiles          = null)
        {
            _logger     = logger;
            _fileSystem = fileSystem ?? new FileSystem();

            var outputPath = ValidateOutputPath(basePath);

            IgnoredMethods             = ValidateIgnoredMethods(ignoredMethods ?? Array.Empty <string>());
            BasePath                   = basePath;
            CompareToDashboard         = compareToDashboard;
            OutputPath                 = outputPath;
            Reporters                  = ValidateReporters(reporters);
            ProjectUnderTestNameFilter = projectUnderTestNameFilter;
            AdditionalTimeoutMS        = additionalTimeoutMS;
            ExcludedMutations          = ValidateExcludedMutations(excludedMutations).ToList();
            LogOptions                 = new LogOptions(ValidateLogLevel(logLevel), logToFile, outputPath);
            DevMode = devMode;
            ConcurrentTestrunners             = ValidateConcurrentTestrunners(maxConcurrentTestRunners);
            Optimizations                     = ValidateMode(coverageAnalysis) | (abortTestOnFail ? OptimizationFlags.AbortTestOnKill : 0) | (disableSimultaneousTesting ? OptimizationFlags.DisableTestMix : 0);
            Thresholds                        = ValidateThresholds(thresholdHigh, thresholdLow, thresholdBreak);
            FilePatterns                      = ValidateFilePatterns(mutate, filesToExclude);
            TestRunner                        = ValidateTestRunner(testRunner);
            SolutionPath                      = ValidateSolutionPath(basePath, solutionPath);
            LanguageVersion                   = ValidateLanguageVersion(languageVersion);
            OptimizationMode                  = coverageAnalysis;
            DiffEnabled                       = diff || compareToDashboard;
            CompareToDashboard                = compareToDashboard;
            GitDiffSource                     = ValidateGitDiffTarget(gitDiffTarget);
            TestProjects                      = ValidateTestProjects(testProjects);
            DashboardUrl                      = dashboardUrl;
            (DashboardApiKey, ProjectName)    = ValidateDashboardReporter(dashboardApiKey, projectName);
            (ProjectVersion, FallbackVersion) = ValidateCompareToDashboard(projectVersion, fallbackVersion, gitDiffTarget);
            DiffIgnoreFiles                   = ValidateDiffIgnoreFiles(diffIgnoreFiles);
            ModuleName                        = !Reporters.Contains(Reporter.Dashboard) ? null : moduleName;
            BaselineProvider                  = ValidateBaselineProvider(baselineStorageLocation);
            (AzureSAS, AzureFileStorageUrl)   = ValidateAzureFileStorage(azureSAS, azureFileStorageUrl);
            MutationLevel                     = ValidateMutationLevel(mutationLevel ?? MutationLevel.Standard.ToString());
        }