コード例 #1
0
        private void DiscoverTests(IEnumerable <string> testItems, FrameworkDiscoverer frameworkDiscoverer, ITestCaseDiscoverySink discoverySink, IMessageLogger logger, string nodeExePath, string projectFullPath, string testFrameworkName)
        {
            var testFramework = frameworkDiscoverer.GetFramework(testFrameworkName);

            if (testFramework == null)
            {
                logger.SendMessage(TestMessageLevel.Warning, $"Ignoring unsupported test framework '{testFrameworkName}'.");
            }

            var discoverWorker = new TestDiscovererWorker(projectFullPath, nodeExePath);

            discoverWorker.DiscoverTests(testItems, testFramework, logger, discoverySink, nameof(NetCoreTestDiscoverer));
        }
コード例 #2
0
        private void DiscoverTests(Dictionary <string, HashSet <string> > testItems, FrameworkDiscoverer frameworkDiscoverer, ITestCaseDiscoverySink discoverySink, IMessageLogger logger, string nodeExePath, string projectFullPath)
        {
            foreach (var testFx in testItems.Keys)
            {
                var testFramework = frameworkDiscoverer.GetFramework(testFx);
                if (testFramework == null)
                {
                    logger.SendMessage(TestMessageLevel.Warning, $"Ignoring unsupported test framework '{testFx}'.");
                    continue;
                }

                var fileList = testItems[testFx];

                var discoverWorker = new TestDiscovererWorker(projectFullPath, NodejsConstants.ExecutorUri, nodeExePath);
                discoverWorker.DiscoverTests(fileList, testFramework, logger, discoverySink);
            }
        }
コード例 #3
0
        internal void DiscoverTestFiles(string packageJsonPath, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            logger.SendMessage(TestMessageLevel.Informational, $"Parsing '{packageJsonPath}'.");

            var packageJson = PackageJsonFactory.Create(packageJsonPath);

            if (string.IsNullOrEmpty(packageJson.TestRoot))
            {
                logger.SendMessage(TestMessageLevel.Informational, "No vsTestOptions|testRoot specified.");
                return;
            }

            var workingDir     = Path.GetDirectoryName(packageJsonPath);
            var testFolderPath = Path.Combine(workingDir, packageJson.TestRoot);

            if (!Directory.Exists(testFolderPath))
            {
                logger.SendMessage(TestMessageLevel.Error, $"Testroot '{packageJson.TestRoot}' doesn't exist.");
                return;
            }

            var testFx = default(TestFramework);

            foreach (var dep in packageJson.AllDependencies)
            {
                testFx = this.frameworkDiscoverer.GetFramework(dep.Name);
                if (testFx != null)
                {
                    break;
                }
            }
            testFx = testFx ?? this.frameworkDiscoverer.GetFramework(TestFrameworkDirectories.ExportRunnerFrameworkName);

            var nodeExePath = Nodejs.GetPathToNodeExecutableFromEnvironment();
            var worker      = new TestDiscovererWorker(packageJsonPath, nodeExePath);

            worker.DiscoverTests(testFolderPath, testFx, logger, discoverySink, nameof(PackageJsonTestDiscoverer));
        }
コード例 #4
0
        private void DiscoverTests(HashSet <string> fileList, TestFramework testFramework, ITestCaseDiscoverySink discoverySink, IMessageLogger logger, string nodeExePath, string projectFullPath)
        {
            var discoverWorker = new TestDiscovererWorker(projectFullPath, NodejsConstants.ExecutorUri, nodeExePath);

            discoverWorker.DiscoverTests(fileList, testFramework, logger, discoverySink);
        }