How to use DiscovererEnumerator class of Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery package

Best Vstest code snippet using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery.DiscovererEnumerator

DiscovererEnumerator.cs

Source:DiscovererEnumerator.cs Github

copy

Full Screen

...28 using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources;29 /// <summary>30 /// Enumerates through all the discoverers.31 /// </summary>32 internal class DiscovererEnumerator33 {34 private readonly DiscoveryResultCache discoveryResultCache;35 private readonly ITestPlatformEventSource testPlatformEventSource;36 private readonly IRequestData requestData;37 private readonly IAssemblyProperties assemblyProperties;38 private readonly CancellationToken cancellationToken;39 /// <summary>40 /// Initializes a new instance of the <see cref="DiscovererEnumerator"/> class.41 /// </summary>42 /// <param name="requestData">The request data for providing discovery services and data.</param>43 /// <param name="discoveryResultCache"> The discovery result cache. </param>44 public DiscovererEnumerator(IRequestData requestData, DiscoveryResultCache discoveryResultCache, CancellationToken token)45 : this(requestData, discoveryResultCache, TestPlatformEventSource.Instance, token)46 {47 }48 /// <summary>49 /// Initializes a new instance of the <see cref="DiscovererEnumerator"/> class.50 /// </summary>51 /// <param name="requestData">The request data for providing discovery services and data.</param>52 /// <param name="discoveryResultCache"> The discovery result cache. </param>53 /// <param name="testPlatformEventSource">Telemetry events receiver</param>54 /// <param name="token">Cancellation Token to abort discovery</param>55 public DiscovererEnumerator(IRequestData requestData,56 DiscoveryResultCache discoveryResultCache,57 ITestPlatformEventSource testPlatformEventSource,58 CancellationToken token)59 : this(requestData, discoveryResultCache, testPlatformEventSource, new AssemblyProperties(), token)60 {61 }62 /// <summary>63 /// Initializes a new instance of the <see cref="DiscovererEnumerator"/> class.64 /// </summary>65 /// <param name="requestData">The request data for providing discovery services and data.</param>66 /// <param name="discoveryResultCache"> The discovery result cache. </param>67 /// <param name="testPlatformEventSource">Telemetry events receiver</param>68 /// <param name="assemblyProperties">Information on the assemblies being discovered</param>69 /// <param name="token">Cancellation Token to abort discovery</param>70 public DiscovererEnumerator(IRequestData requestData,71 DiscoveryResultCache discoveryResultCache,72 ITestPlatformEventSource testPlatformEventSource,73 IAssemblyProperties assemblyProperties,74 CancellationToken token)75 {76 // Added this to make class testable, needed a PEHeader mocked Instance77 this.discoveryResultCache = discoveryResultCache;78 this.testPlatformEventSource = testPlatformEventSource;79 this.requestData = requestData;80 this.assemblyProperties = assemblyProperties;81 this.cancellationToken = token;82 }83 /// <summary>84 /// Discovers tests from the sources.85 /// </summary>86 /// <param name="testExtensionSourceMap"> The test extension source map. </param>87 /// <param name="settings"> The settings. </param>88 /// <param name="testCaseFilter"> The test case filter. </param>89 /// <param name="logger"> The logger. </param>90 public void LoadTests(IDictionary<string, IEnumerable<string>> testExtensionSourceMap, IRunSettings settings, string testCaseFilter, IMessageLogger logger)91 {92 this.testPlatformEventSource.DiscoveryStart();93 try94 {95 foreach (var kvp in testExtensionSourceMap)96 {97 this.LoadTestsFromAnExtension(kvp.Key, kvp.Value, settings, testCaseFilter, logger);98 }99 }100 finally101 {102 this.testPlatformEventSource.DiscoveryStop(this.discoveryResultCache.TotalDiscoveredTests);103 }104 }105 /// <summary>106 /// Loads test cases from individual source.107 /// Discovery extensions update progress through ITestCaseDiscoverySink.108 /// Discovery extensions sends discovery messages through TestRunMessageLoggerProxy109 /// </summary>110 /// <param name="extensionAssembly"> The extension Assembly. </param>111 /// <param name="sources"> The sources. </param>112 /// <param name="settings"> The settings. </param>113 /// <param name="settings"> The test case filter. </param>114 /// <param name="logger"> The logger. </param>115 [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",116 Justification = "This methods must invoke all possible discoverers and not fail or crash in any one.")]117 private void LoadTestsFromAnExtension(string extensionAssembly, IEnumerable<string> sources, IRunSettings settings, string testCaseFilter, IMessageLogger logger)118 {119 // Stopwatch to collect metrics120 var timeStart = DateTime.UtcNow;121 var discovererToSourcesMap = GetDiscovererToSourcesMap(extensionAssembly, sources, logger, this.assemblyProperties);122 var totalAdapterLoadTIme = DateTime.UtcNow - timeStart;123 // Collecting Data Point for TimeTaken to Load Adapters124 this.requestData.MetricsCollection.Add(TelemetryDataConstants.TimeTakenToLoadAdaptersInSec, totalAdapterLoadTIme.TotalSeconds);125 // Warning is logged for in the inner function126 if (discovererToSourcesMap == null || !discovererToSourcesMap.Any())127 {128 return;129 }130 double totalTimeTakenByAdapters = 0;131 double totalAdaptersUsed = 0;132 try133 {134 // Collecting Total Number of Adapters Discovered in Machine135 this.requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAdapterDiscoveredDuringDiscovery, discovererToSourcesMap.Keys.Count);136 var context = new DiscoveryContext { RunSettings = settings };137 context.FilterExpressionWrapper = !string.IsNullOrEmpty(testCaseFilter) ? new FilterExpressionWrapper(testCaseFilter) : null;138 // Set on the logger the TreatAdapterErrorAsWarning setting from runsettings.139 this.SetAdapterLoggingSettings(logger, settings);140 var discoverySink = new TestCaseDiscoverySink(this.discoveryResultCache);141 foreach (var discoverer in discovererToSourcesMap.Keys)142 {143 if (this.cancellationToken.IsCancellationRequested)144 {145 EqtTrace.Info("DiscovererEnumerator.LoadTestsFromAnExtension: Cancellation Requested. Aborting the discovery");146 LogTestsDiscoveryCancellation(logger);147 return;148 }149 this.DiscoverTestsFromSingleDiscoverer(discoverer, discovererToSourcesMap, context, discoverySink, logger, ref totalAdaptersUsed, ref totalTimeTakenByAdapters);150 }151 if (this.discoveryResultCache.TotalDiscoveredTests == 0)152 {153 LogWarningOnNoTestsDiscovered(sources, testCaseFilter, logger);154 }155 }156 finally157 {158 this.CollectTelemetryAtEnd(totalTimeTakenByAdapters, totalAdaptersUsed);159 }160 }161 private void LogTestsDiscoveryCancellation(IMessageLogger logger)162 {163 logger.SendMessage(TestMessageLevel.Warning, CrossPlatEngineResources.TestDiscoveryCancelled);164 }165 private void CollectTelemetryAtEnd(double totalTimeTakenByAdapters, double totalAdaptersUsed)166 {167 // Collecting Total Time Taken by Adapters168 this.requestData.MetricsCollection.Add(TelemetryDataConstants.TimeTakenInSecByAllAdapters,169 totalTimeTakenByAdapters);170 // Collecting Total Adapters Used to Discover tests171 this.requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAdapterUsedToDiscoverTests,172 totalAdaptersUsed);173 }174 private void DiscoverTestsFromSingleDiscoverer(175 LazyExtension<ITestDiscoverer, ITestDiscovererCapabilities> discoverer,176 Dictionary<LazyExtension<ITestDiscoverer, ITestDiscovererCapabilities>, IEnumerable<string>> discovererToSourcesMap,177 DiscoveryContext context,178 TestCaseDiscoverySink discoverySink,179 IMessageLogger logger,180 ref double totalAdaptersUsed,181 ref double totalTimeTakenByAdapters)182 {183 if (!DiscovererEnumerator.TryToLoadDiscoverer(discoverer, logger, out var discovererType))184 {185 // Fail to instantiate the discoverer type.186 return;187 }188 // on instantiated successfully, get tests189 try190 {191 EqtTrace.Verbose(192 "DiscovererEnumerator.DiscoverTestsFromSingleDiscoverer: Loading tests for {0}",193 discoverer.Value.GetType().FullName);194 if (discoverer.Metadata.DefaultExecutorUri == null)195 {196 throw new Exception($@"DefaultExecutorUri is null, did you decorate the discoverer class with [DefaultExecutorUri()] attribute? For example [DefaultExecutorUri(""executor://example.testadapter"")].");197 }198 var currentTotalTests = this.discoveryResultCache.TotalDiscoveredTests;199 var newTimeStart = DateTime.UtcNow;200 this.testPlatformEventSource.AdapterDiscoveryStart(discoverer.Metadata.DefaultExecutorUri.AbsoluteUri);201 discoverer.Value.DiscoverTests(discovererToSourcesMap[discoverer], context, logger, discoverySink);202 var totalAdapterRunTime = DateTime.UtcNow - newTimeStart;203 this.testPlatformEventSource.AdapterDiscoveryStop(this.discoveryResultCache.TotalDiscoveredTests -204 currentTotalTests);205 // Record Total Tests Discovered By each Discoverer.206 var totalTestsDiscoveredByCurrentDiscoverer = this.discoveryResultCache.TotalDiscoveredTests - currentTotalTests;207 this.requestData.MetricsCollection.Add(208 string.Format("{0}.{1}", TelemetryDataConstants.TotalTestsByAdapter,209 discoverer.Metadata.DefaultExecutorUri), totalTestsDiscoveredByCurrentDiscoverer);210 totalAdaptersUsed++;211 EqtTrace.Verbose("DiscovererEnumerator.DiscoverTestsFromSingleDiscoverer: Done loading tests for {0}",212 discoverer.Value.GetType().FullName);213 var discovererFromDeprecatedLocations = IsDiscovererFromDeprecatedLocations(discoverer);214 if (discovererFromDeprecatedLocations)215 {216 logger.SendMessage(TestMessageLevel.Warning,217 string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.DeprecatedAdapterPath));218 }219 // Collecting Data Point for Time Taken to Discover Tests by each Adapter220 this.requestData.MetricsCollection.Add(221 string.Format("{0}.{1}", TelemetryDataConstants.TimeTakenToDiscoverTestsByAnAdapter,222 discoverer.Metadata.DefaultExecutorUri), totalAdapterRunTime.TotalSeconds);223 totalTimeTakenByAdapters += totalAdapterRunTime.TotalSeconds;224 }225 catch (Exception e)226 {227 var message = string.Format(228 CultureInfo.CurrentUICulture,229 CrossPlatEngineResources.ExceptionFromLoadTests,230 discovererType.Name,231 e.Message);232 logger.SendMessage(TestMessageLevel.Error, message);233 EqtTrace.Error("DiscovererEnumerator.DiscoverTestsFromSingleDiscoverer: {0} ", e);234 }235 }236 private static bool TryToLoadDiscoverer(LazyExtension<ITestDiscoverer, ITestDiscovererCapabilities> discoverer, IMessageLogger logger, out Type discovererType)237 {238 discovererType = null;239 // See if discoverer can be instantiated successfully else move next.240 try241 {242 discovererType = discoverer.Value.GetType();243 }244 catch (Exception e)245 {246 var mesage = string.Format(247 CultureInfo.CurrentUICulture,248 CrossPlatEngineResources.DiscovererInstantiationException,249 e.Message);250 logger.SendMessage(TestMessageLevel.Warning, mesage);251 EqtTrace.Error("DiscovererEnumerator.LoadTestsFromAnExtension: {0} ", e);252 return false;253 }254 return true;255 }256 private static bool IsDiscovererFromDeprecatedLocations(257 LazyExtension<ITestDiscoverer, ITestDiscovererCapabilities> discoverer)258 {259 if (CrossPlatEngine.Constants.DefaultAdapters.Contains(discoverer.Metadata.DefaultExecutorUri.ToString(),260 StringComparer.OrdinalIgnoreCase))261 {262 return false;263 }264 var discovererLocation = discoverer.Value.GetType().GetTypeInfo().Assembly.GetAssemblyLocation();265 return Path.GetDirectoryName(discovererLocation)...

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;7using Microsoft.VisualStudio.TestPlatform.ObjectModel;8using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;9using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;10{11 {12 private ITestDiscoveryEventsHandler discoveryEventsHandler;13 private ITestLogger logger;14 private string settingsXml;15 private string runSettingsXml;16 private string testSource;17 private string testCaseFilter;18 private bool isCanceled;19 public DiscovererEnumerator(ITestDiscoveryEventsHandler discoveryEventsHandler, ITestLogger logger, string settingsXml, string runSettingsXml, string testSource, string testCaseFilter, bool isCanceled)20 {21 this.discoveryEventsHandler = discoveryEventsHandler;22 this.logger = logger;23 this.settingsXml = settingsXml;24 this.runSettingsXml = runSettingsXml;25 this.testSource = testSource;26 this.testCaseFilter = testCaseFilter;27 this.isCanceled = isCanceled;28 }29 public void Run()30 {31 var discoverer = new TestDiscoverer();32 discoverer.DiscoverTests(new List<string> { testSource }, settingsXml, runSettingsXml, discoveryEventsHandler, logger, testCaseFilter, isCanceled);33 }34 }35}36using System;37using System.Collections.Generic;38using System.Linq;39using System.Text;40using System.Threading.Tasks;41using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;42using Microsoft.VisualStudio.TestPlatform.ObjectModel;43using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;44using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;45{46 {47 public void DiscoverTests(IEnumerable<string> sources, string settingsXml, string runSettingsXml, ITestDiscoveryEventsHandler discoveryEventsHandler, ITestLogger logger, string testCaseFilter, bool isCanceled)48 {49 var discoverer = new TestDiscoverer();50 discoverer.DiscoverTests(new List<string> { testSource }, settingsXml, runSettingsXml, discoveryEventsHandler, logger, testCaseFilter, isCanceled);51 }52 }53}

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;7using Microsoft.VisualStudio.TestPlatform.ObjectModel;8using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;9using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;10{11 {12 static void Main(string[] args)13 {14 var discovererEnumerator = new DiscovererEnumerator();15 var discoverers = discovererEnumerator.GetDiscoverers();16 var discoverer = discoverers.FirstOrDefault();17 var discovererInfo = discovererEnumerator.GetDiscoverer(discoverer);18 var discovererCapabilities = discovererEnumerator.GetCapabilities(discoverer);19 var discovererExtension = discovererEnumerator.GetDiscovererExtension(discoverer);20 var discovererExtension2 = discovererEnumerator.GetDiscovererExtension(discovererInfo);21 var discovererExtension3 = discovererEnumerator.GetDiscovererExtension(discovererCapabilities);22 var discovererExtension4 = discovererEnumerator.GetDiscovererExtension(discovererEnumerator.GetDiscoverers().FirstOrDefault());23 Console.WriteLine("Hello World!");24 }25 }26}27using System;28using System.Linq;29using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;30using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;31using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;32{33 {34 static void Main(string[] args)35 {36 var discovererEnumerator = new TestableDiscovererEnumerator();37 var discoverers = discovererEnumerator.GetDiscoverers();38 var discoverer = discoverers.FirstOrDefault();39 var discovererInfo = discovererEnumerator.GetDiscoverer(discoverer);40 var discovererCapabilities = discovererEnumerator.GetCapabilities(discoverer);41 var discovererExtension = discovererEnumerator.GetDiscovererExtension(discoverer);42 var discovererExtension2 = discovererEnumerator.GetDiscovererExtension(discovererInfo);43 var discovererExtension3 = discovererEnumerator.GetDiscovererExtension(discovererCapabilities);44 var discovererExtension4 = discovererEnumerator.GetDiscovererExtension(discovererEnumerator.GetDiscoverers().FirstOrDefault());45 Console.WriteLine("Hello World!");46 }47 }48}

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;7using Microsoft.VisualStudio.TestPlatform.ObjectModel;8using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;9using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;10{11 {12 static void Main(string[] args)13 {14 var discovererEnumerator = new DiscovererEnumerator();15 var discoverables = discovererEnumerator.GetDiscoverers();16 foreach (var discoverable in discoverables)17 {18 Console.WriteLine("Discoverer: " + discoverable);19 }20 var discoverer = discovererEnumerator.GetDiscoverer("NUnit3TestDiscoverer");

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;2using Microsoft.VisualStudio.TestPlatform.ObjectModel;3using System;4using System.Collections.Generic;5using System.Linq;6using System.Text;7using System.Threading.Tasks;8{9 {10 static void Main(string[] args)11 {12 var sources = new List<string>() { "C:\\Users\\v-akshar\\source\\repos\\MyProject\\MyProject\\bin\\Debug\\netcoreapp2.1\\MyProject.dll" };13 var testCases = DiscovererEnumerator.GetDiscoveredTests(sources, null, null);14 foreach (TestCase testCase in testCases)15 {16 Console.WriteLine(testCase.DisplayName);17 }18 Console.ReadLine();19 }20 }21}22The code above is a very simple code that uses DiscovererEnumerator class of Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery package to discover all the tests in a project. The tests are discovered using the GetDiscoveredTests() method. This method accepts three parameters:

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.ObjectModel;7using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;8using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;9using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;10using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;11using System.Diagnostics;12using System.IO;13{14 {15 static void Main(string[] args)16 {17 DiscovererEnumerator discovererEnumerator = new DiscovererEnumerator();18 var discoverers = discovererEnumerator.GetDiscoverers();19 foreach (var discoverer in discoverers)20 {21 Console.WriteLine(discoverer.Key);22 }23 Console.WriteLine("Enter the full path of the test assembly");24 string path = Console.ReadLine();25 DiscovererEnumerator discovererEnumerator1 = new DiscovererEnumerator();26 var discoverers1 = discovererEnumerator1.GetDiscoverers();27 var discoverer1 = discoverers1.First().Value;28 var discoveryContext = new DiscoveryContext()29 {30 };31 var logger = new ConsoleLogger();32 var discoverySink = new DiscoverySink();33 var discoveryCriteria = new DiscoveryCriteria(new List<string>() { path }, 32, false);34 discoverer1.DiscoverTests(discoveryCriteria, discoveryContext, logger, discoverySink);35 var testCases = discoverySink.TestCases;36 foreach (var testCase in testCases)37 {38 Console.WriteLine(testCase.FullyQualifiedName);39 }40 Console.ReadKey();41 }42 }43 {44 public void SendMessage(TestMessageLevel testMessageLevel, string message)45 {46 Console.WriteLine(message);47 }48 }49 {50 public IList<TestCase> TestCases { get; set; }51 public DiscoverySink()52 {53 TestCases = new List<TestCase>();54 }55 public void SendTestCase(TestCase discoveredTest)56 {57 TestCases.Add(discoveredTest);58 }59 }60}61C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery;7using Microsoft.VisualStudio.TestPlatform.ObjectModel;8using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;9{10 {11 static void Main(string[] args)12 {13 var discovererEnumerator = new DiscovererEnumerator();14 var discoverers = discovererEnumerator.GetDiscoverers();15 var discoverer = discoverers.FirstOrDefault();16 var logger = new ConsoleLogger();17 var context = new DiscoveryContext();18 var discoverySink = new DiscoverySink();19 discoverer.Value.DiscoverTests(new[] { "C:\\Users\\user\\Desktop\\2.cs" }, context, logger, discoverySink);20 Console.WriteLine(discoverySink.Tests.Count);21 Console.ReadKey();22 }23 }24}25using System;26using System.Collections.Generic;27using System.Linq;28using System.Text;29using System.Threading.Tasks;30using Microsoft.VisualStudio.TestPlatform.ObjectModel;31using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;32{33 {34 static void Main(string[] args)35 {36 var logger = new ConsoleLogger();37 var context = new DiscoveryContext();38 var discoverySink = new TestCaseDiscoverySink();39 var discoverer = new NUnit3TestDiscoverer();40 discoverer.DiscoverTests(new[] { "C:\\Users\\user\\Desktop\\2.cs" }, context, logger, discoverySink);41 Console.WriteLine(discoverySink.DiscoveredTestCases.Count);42 Console.ReadKey();43 }44 }45}46using System;47using System.Collections.Generic;48using System.Linq;49using System.Text;50using System.Threading.Tasks;51using Microsoft.VisualStudio.TestPlatform.ObjectModel;52using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;53using Microsoft.VisualStudio.TestPlatform.TestFramework;54{55 {56 static void Main(string[] args)57 {58 var logger = new ConsoleLogger();59 var context = new DiscoveryContext();60 var discoverySink = new DiscoverySink();

Full Screen

Full Screen

DiscovererEnumerator

Using AI Code Generation

copy

Full Screen

1string source = @"C:\Users\user\Desktop\3.cs";2string runSettings = @"C:\Users\user\Desktop\1.runsettings";3string loggerUri = @"C:\Users\user\Desktop\2.dll";4string loggerLevel = "Detailed";5string testFilter = null;6string testCaseFilter = null;7var discoverySink = new DiscoverySink();8var discoveryCriteria = new DiscoveryCriteria(source, runSettings, loggerUri, loggerLevel, testFilter, testCaseFilter);9var discovererEnumerator = new DiscovererEnumerator(discoverySink, discoveryCriteria);10discovererEnumerator.DiscoverTests();11using System;12using System.Collections.Generic;13using System.Linq;14using System.Text;15using System.Threading.Tasks;16using Microsoft.VisualStudio.TestPlatform.ObjectModel;17using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;18using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;19{20 [FriendlyName("Console")]21 {22 public void Initialize(TestLoggerEvents events, string testRunDirectory)23 {24 events.TestRunMessage += Events_TestRunMessage;25 }26 private void Events_TestRunMessage(object sender, TestRunMessageEventArgs e)27 {28 Console.WriteLine(e.Message);29 }

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful