public (IDictionary <Guid, VsTestDescription>, TestSet) DiscoverTests(string runSettings) { if (_vsTests != null) { return(_vsTests, _tests); } using (var waitHandle = new AutoResetEvent(false)) { var handler = new DiscoveryEventHandler(waitHandle, _messages); var generateRunSettings = GenerateRunSettings(null, false, false, null); _vsTestConsole.DiscoverTests(_sources, runSettings ?? generateRunSettings, handler); waitHandle.WaitOne(); if (handler.Aborted) { _logger.LogError($"{RunnerId}: Test discovery has been aborted!"); } _vsTests = new Dictionary <Guid, VsTestDescription>(handler.DiscoveredTestCases.Count); foreach (var testCase in handler.DiscoveredTestCases) { if (!_vsTests.ContainsKey(testCase.Id)) { _vsTests[testCase.Id] = new VsTestDescription(testCase); } _vsTests[testCase.Id].AddSubCase(); } DetectTestFramework(_vsTests.Values); } _tests.RegisterTests(_vsTests.Values.Select(t => t.Description)); return(_vsTests, _tests); }
public IEnumerable <TestCase> DiscoverTests(string runSettings = null) { var waitHandle = new AutoResetEvent(false); var handler = new DiscoveryEventHandler(waitHandle, _messages); _vsTestConsole.DiscoverTests(_sources, runSettings ?? GenerateRunSettings(0), handler); waitHandle.WaitOne(); return(handler.DiscoveredTestCases); }
public void DiscoverTests(string runSettings = null) { var waitHandle = new AutoResetEvent(false); var handler = new DiscoveryEventHandler(waitHandle, _messages); _vsTestConsole.DiscoverTests(_sources, runSettings ?? GenerateRunSettings(0), handler); waitHandle.WaitOne(); _testCasesDiscovered = handler.DiscoveredTestCases.Count; }
public ICollection <TestCase> DiscoverTests(string runSettings = null) { if (_discoveredTests == null) { using (var waitHandle = new AutoResetEvent(false)) { var handler = new DiscoveryEventHandler(waitHandle, _messages); var generateRunSettings = GenerateRunSettings(null, false); _vsTestConsole.DiscoverTests(_sources, runSettings ?? generateRunSettings, handler); waitHandle.WaitOne(); if (handler.Aborted) { Logger.LogError($"Runner {_id}: Test discovery has been aborted!"); } SetListOfTests(handler.DiscoveredTestCases); } } return(_discoveredTests); }
public ICollection <TestCase> DiscoverTests(string runSettings = null) { if (_discoveredTests != null) { return(_discoveredTests); } using (var waitHandle = new AutoResetEvent(false)) { var handler = new DiscoveryEventHandler(waitHandle, _messages); var generateRunSettings = GenerateRunSettings(null, false, false, null); _vsTestConsole.DiscoverTests(_sources, runSettings ?? generateRunSettings, handler); waitHandle.WaitOne(); if (handler.Aborted) { _logger.LogError($"{RunnerId}: Test discovery has been aborted!"); } _discoveredTests = handler.DiscoveredTestCases; DetectTestFramework(handler.DiscoveredTestCases); } return(_discoveredTests); }