示例#1
0
 public virtual void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
 {
     TestAdapterInfo = CreateTestAdapterInfo();
     var testLogger = TestAdapterInfo.CreateLogger(logger);
     var discoverLogger = new TestLogger(testLogger, "Discover");
     var testSettings = discoveryContext.RunSettings.GetTestSettings(TestAdapterInfo.SettingsName);
     var count = 0;
     var testCount = 0;
     foreach (var source in sources)
     {
         var sourceSettings = GetSourceSettings(source, testSettings);
         if (sourceSettings != null)
         {
             testCount += DiscoverTests(sourceSettings, testLogger, discoverySink).Result;
             count += 1;
         }
         else
         {
             discoverLogger.Warn("Could not get settings for {0}", source);
         }
     }
     if (count > 0 || testCount > 0)
     {
         discoverLogger.Info("{0} tests discovered in {1} test containers", testCount, count);
     }
 }
示例#2
0
        public virtual void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            TestAdapterInfo = CreateTestAdapterInfo();

            var testLogger = TestAdapterInfo.CreateLogger(frameworkHandle);
            var runLogger = new TestLogger(testLogger, "Run");
            var testSettings = runContext.RunSettings.GetTestSettings(TestAdapterInfo.SettingsName);
            var count = 0;
            var testCount = 0;

            foreach (var source in sources)
            {
                var sourceSettings = GetSourceSettings(source, testSettings);
                if (sourceSettings != null)
                {
                    testCount += RunTests(sourceSettings, testLogger, runContext, frameworkHandle).Result;
                    count += 1;
                }
                else
                {
                    runLogger.Warn("Could not get settings for {0}", source);
                }
            }

            if (count > 0 || testCount > 0)
            {
                runLogger.Info("{0} tests run in {1} test containers", testCount, count);
            }
        }