public void OptionsValidator_ShouldThrowValidationExceptionOnEmptyBasePathValues(string basePath) { var target = new StrykerOptionsValidator(); var options = new StrykerOptions(basePath, null, null, null, null); Assert.Throws <ValidationException>(() => target.Validate(options)); }
public void OptionsValidator_ShouldThrowValidationExceptionOnFalseBuildConfigValues(string fakeReporter) { var target = new StrykerOptionsValidator(); var options = new StrykerOptions("C:/ExampleProject/", fakeReporter, null); Assert.Throws <ValidationException>(() => target.Validate(options)); }
public void OptionsValidator_ShouldAcceptReporterValues(string reporter) { var target = new StrykerOptionsValidator(); var options = new StrykerOptions("C:/ExampleProject/", reporter, null); var result = target.Validate(options); // Should default to Console result.Reporter.ShouldBe(string.IsNullOrWhiteSpace(reporter) ? "Console" : reporter); }
/// <summary> /// Starts a mutation test run /// </summary> /// <exception cref="StrykerException">For managed exceptions</exception> /// <param name="options">The user options</param> public void RunMutationTest(StrykerOptions options) { // start stopwatch var stopwatch = new Stopwatch(); stopwatch.Start(); // setup logging ApplicationLogging.ConfigureLogger(options.LogOptions); var logger = ApplicationLogging.LoggerFactory.CreateLogger <StrykerRunner>(); try { // validate options options = new StrykerOptionsValidator().Validate(options); // initialyze _reporter = ReporterFactory.Create(options.Reporter); _initialisationProcess = _initialisationProcess ?? new InitialisationProcess(_reporter); _input = _initialisationProcess.Initialize(options); _mutationTestProcess = _mutationTestProcess ?? new MutationTestProcess( mutationTestInput: _input, options: options, reporter: _reporter, mutationTestExecutor: new MutationTestExecutor(_input.TestRunner)); // mutate _mutationTestProcess.Mutate(); // test mutations _mutationTestProcess.Test(); } catch (Exception ex) { logger.LogError(ex, "An error occurred during the mutationtest run "); throw; } finally { // log duration stopwatch.Stop(); logger.LogInformation("Time Elapsed {0}", stopwatch.Elapsed); } }