Beispiel #1
0
 public TestContextBuilder(
     IFileSystemWrapper fileSystem,
     IReferenceProcessor referenceProcessor,
     IHttpWrapper httpWrapper,
     IFileProbe fileProbe,
     ICoverageEngineFactory coverageEngineFactory,
     IEnumerable <IFrameworkDefinition> frameworkDefinitions,
     IChutzpahTestSettingsService settingsService)
 {
     this.referenceProcessor   = referenceProcessor;
     this.httpClient           = httpWrapper;
     this.fileSystem           = fileSystem;
     this.fileProbe            = fileProbe;
     this.frameworkDefinitions = frameworkDefinitions;
     this.settingsService      = settingsService;
     this.mainCoverageEngine   = coverageEngineFactory.CreateCoverageEngine();
 }
Beispiel #2
0
        private ICoverageEngine GetConfiguredCoverageEngine(TestOptions options, ChutzpahTestSettingsFile chutzpahTestSettings)
        {
            // Don't run code coverage if in discovery mode
            if (options.TestExecutionMode == TestExecutionMode.Discovery)
            {
                return(null);
            }

            var codeCoverageEnabled = (!chutzpahTestSettings.EnableCodeCoverage.HasValue && options.CoverageOptions.Enabled) ||
                                      (chutzpahTestSettings.EnableCodeCoverage.HasValue && chutzpahTestSettings.EnableCodeCoverage.Value);

            if (!codeCoverageEnabled)
            {
                return(null);
            }

            ChutzpahTracer.TraceInformation("Setting up code coverage in test context");
            var coverageEngine = coverageEngineFactory.CreateCoverageEngine();

            coverageEngine.ClearPatterns();
            coverageEngine.AddIncludePatterns(chutzpahTestSettings.CodeCoverageIncludes.Concat(options.CoverageOptions.IncludePatterns));
            coverageEngine.AddExcludePatterns(chutzpahTestSettings.CodeCoverageExcludes.Concat(options.CoverageOptions.ExcludePatterns));
            return(coverageEngine);
        }