public TestRunResult CaptureCoverage(bool cantUsePipe, bool cantUseUnloadAppDomain) { if (cantUseUnloadAppDomain) { _logger.LogWarning("Can't capture the test coverage as the target framework does not support 'AppDomain'. "); return new TestRunResult() { Success = true }; } if (cantUsePipe) { _logger.LogDebug("Target framework does not support NamedPipes. Stryker will use environment variables instead."); } if (_flags.HasFlag(OptimizationFlags.SkipUncoveredMutants) || _flags.HasFlag(OptimizationFlags.CoverageBasedTest)) { var collector = new CoverageCollector(); collector.SetLogger((message) => _logger.LogTrace(message)); collector.Init(!cantUsePipe); var coverageEnvironment = collector.GetEnvironmentVariables(); var result = LaunchTestProcess(null, coverageEnvironment); var data = collector.RetrieveCoverData(); var coveredMutants = data.Split(";")[0].Split(",", StringSplitOptions.RemoveEmptyEntries); CoverageMutants.DeclareCoveredMutants(coveredMutants.Select(int.Parse)); return result; } return new TestRunResult(){Success = true}; }
public TestRunResult CaptureCoverage() { if (_flags.HasFlag(OptimizationFlags.SkipUncoveredMutants)) { var collector = new CoverageCollector(); collector.SetLogger((message) => Logger.LogTrace(message)); collector.Init(true); var coverageEnvironment = collector.GetEnvironmentVariables(); var result = LaunchTestProcess(null, coverageEnvironment); var data = collector.RetrieveCoverData("full"); CoverageMutants.DeclareCoveredMutants(data.Split(",").Select(int.Parse)); return(result); } else { return(LaunchTestProcess(null, null)); } }