public async Task RunCore() { _mutantDetailsController.Initialize(); _currentSession = new MutationTestingSession { Filter = _choices.Filter, Choices = _choices, }; if (_choices.TestAssemblies.All(n => n.IsIncluded == false)) //if (_choices.TestAssemblies.Select(a => a.TestsLoadContext.SelectedTests.TestIds.Count).Sum() == 0) { throw new NoTestsSelectedException(); } _log.Info("Initializing test environment..."); _log.Info("Creating pure mutant for initial checks..."); AssemblyNode assemblyNode; Mutant changelessMutant = _mutantsContainer.CreateEquivalentMutant(out assemblyNode); _sessionEventsSubject.OnNext(new MutationFinishedEventArgs(OperationsState.MutationFinished) { MutantsGrouped = assemblyNode.InList(), }); var verifiEvents = _sessionEventsSubject .OfType <MutantVerifiedEvent>() .Subscribe(e => { if (e.Mutant == changelessMutant && !e.VerificationResult) { _svc.Logging.ShowWarning(UserMessages.ErrorPretest_VerificationFailure( changelessMutant.MutantTestSession.Exception.Message)); } }); IObjectRoot <TestingMutant> testingMutant = _testingMutantFactory .CreateWithParams(_sessionEventsSubject, changelessMutant); var result = await testingMutant.Get.RunAsync(); verifiEvents.Dispose(); _choices.MutantsTestingOptions.TestingTimeoutSeconds = (int)((_options.TimeFactorForMutations * changelessMutant.MutantTestSession.TestingTimeMiliseconds) + 1); bool canContinue = CheckForTestingErrors(changelessMutant); if (!canContinue) { throw new TestingErrorsException(); } await Task.Run(() => { CreateMutants(); RunTests(); }); }
public void Test() { var gen = new XmlResultsGenerator(null, null, null, null, null); var muSession = new MutationTestingSession(); var mutar = new MutationTarget(new MutationVariant()); var ass = new AssemblyNode("Assembly"); muSession.MutantsGrouped.Add(ass); var nodeNamespace = new TypeNamespaceNode(ass, "Namespace"); ass.Children.Add(nodeNamespace); var nodeType = new TypeNode(nodeNamespace, "Type"); nodeNamespace.Children.Add(nodeType); var nodeMethod = new MethodNode(nodeType, "Method", null, true); nodeType.Children.Add(nodeMethod); var nodeGroup = new MutantGroup("Gr1", nodeMethod); nodeMethod.Children.Add(nodeGroup); var nodeMutant = new Mutant("m1", nodeGroup, mutar); nodeGroup.Children.Add(nodeMutant); XDocument generateResults = gen.GenerateResults(muSession, false, false, ProgressCounter.Inactive(), CancellationToken.None).Result; Console.WriteLine(generateResults.ToString()); //gen. }
public void Test() { var gen = new XmlResultsGenerator(null,null,null, null, null); var muSession = new MutationTestingSession(); var mutar = new MutationTarget(new MutationVariant()); var ass = new AssemblyNode("Assembly"); muSession.MutantsGrouped.Add(ass); var nodeNamespace = new TypeNamespaceNode(ass, "Namespace"); ass.Children.Add(nodeNamespace); var nodeType = new TypeNode(nodeNamespace, "Type"); nodeNamespace.Children.Add(nodeType); var nodeMethod = new MethodNode(nodeType, "Method", null, true); nodeType.Children.Add(nodeMethod); var nodeGroup = new MutantGroup("Gr1", nodeMethod); nodeMethod.Children.Add(nodeGroup); var nodeMutant = new Mutant("m1", nodeGroup, mutar); nodeGroup.Children.Add(nodeMutant); XDocument generateResults = gen.GenerateResults(muSession, false, false, ProgressCounter.Inactive(), CancellationToken.None).Result; Console.WriteLine(generateResults.ToString()); //gen. }
public async Task RunCore() { _mutantDetailsController.Initialize(); _currentSession = new MutationTestingSession { Filter = _choices.Filter, Choices = _choices, }; if (_choices.TestAssemblies.All(n => n.IsIncluded == false)) //if (_choices.TestAssemblies.Select(a => a.TestsLoadContext.SelectedTests.TestIds.Count).Sum() == 0) { throw new NoTestsSelectedException(); } _log.Info("Initializing test environment..."); _log.Info("Creating pure mutant for initial checks..."); AssemblyNode assemblyNode; Mutant changelessMutant = _mutantsContainer.CreateEquivalentMutant(out assemblyNode); _sessionEventsSubject.OnNext(new MutationFinishedEventArgs(OperationsState.MutationFinished) { MutantsGrouped = assemblyNode.InList(), }); var verifiEvents = _sessionEventsSubject .OfType<MutantVerifiedEvent>() .Subscribe(e => { if (e.Mutant == changelessMutant && !e.VerificationResult) { _svc.Logging.ShowWarning(UserMessages.ErrorPretest_VerificationFailure( changelessMutant.MutantTestSession.Exception.Message)); } }); IObjectRoot<TestingMutant> testingMutant = _testingMutantFactory .CreateWithParams(_sessionEventsSubject, changelessMutant); var result = await testingMutant.Get.RunAsync(); verifiEvents.Dispose(); _choices.MutantsTestingOptions.TestingTimeoutSeconds = (int)((3 * changelessMutant.MutantTestSession.TestingTimeMiliseconds) / 1000 + 1); bool canContinue = CheckForTestingErrors(changelessMutant); if (!canContinue) { throw new TestingErrorsException(); } await Task.Run(() => { CreateMutants(); RunTests(); }); }
public void Run(MutationTestingSession currentSession) { _currentSession = currentSession; _viewModel.Show(); }