Esempio n. 1
0
        public KarmaTestContainerDiscoverer(
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            ILogger logger,
            ISolutionListener solutionListener,
            ITestFilesUpdateWatcher testFilesUpdateWatcher,
            ITestFileAddRemoveListener testFilesAddRemoveListener)
        {
            Logger = KarmaLogger.Create(logger: logger);

            _serviceProvider  = serviceProvider;
            _solutionListener = solutionListener;

            _testFilesUpdateWatcher          = testFilesUpdateWatcher;
            _testFilesUpdateWatcher.Changed += OnProjectItemChanged;

            _testFilesAddRemoveListener          = testFilesAddRemoveListener;
            _testFilesAddRemoveListener.Changed += OnProjectItemChanged;
            _testFilesAddRemoveListener.StartListening();

            _solutionListener.SolutionUnloaded += SolutionListenerOnSolutionUnloaded;
            _solutionListener.ProjectChanged   += OnSolutionProjectChanged;
            _solutionListener.StartListening();

            Logger.Info("KarmaTestContainerDiscoverer created");
        }
Esempio n. 2
0
        public void RunTests(string source, IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            var logger = KarmaLogger.Create(messageLogger: frameworkHandle);
            var karma  = Discover(source, logger);

            if (karma == null)
            {
                return;
            }

            if (tests == null)
            {
                // Run all tests
                tests = karma.GetTestCases(source);
            }

            var testsByName = tests
                              .GroupBy(t => t.DisplayName)
                              .Select(t => new {
                DisplayName = t.Key,
                Tests       = t.Select((tc, i) => new { Test = tc, Index = i })
            })
                              .SelectMany(t => t.Tests)
                              .GroupBy(t => t.Index);

            foreach (var t in testsByName)
            {
                RunTests(source, t.Select(x => x.Test), karma, frameworkHandle, logger);
            }
        }
        public void DiscoverTests(IEnumerable <string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            var karmaLogger = KarmaLogger.Create(messageLogger: logger);

            karmaLogger.Info("DiscoverTests start");
            foreach (var testcase in GetTests(sources, karmaLogger))
            {
                discoverySink.SendTestCase(testcase);
            }
            karmaLogger.Info("DiscoverTests end");
        }
Esempio n. 4
0
 static Item()
 {
     Logger = KarmaLogger.Create();
 }