public IList<TestCase> GetTestsFromExecutable(string executable) { var factory = new TestCaseFactory(executable, _testEnvironment, _diaResolverFactory); IList<TestCase> testCases = factory.CreateTestCases(); _testEnvironment.LogInfo("Found " + testCases.Count + " tests in executable " + executable); foreach (TestCase testCase in testCases) { _testEnvironment.DebugInfo("Added testcase " + testCase.DisplayName); } return testCases; }
private Dictionary <string, TestCaseLocation> FindTestCaseLocationsInBinary( string binary, HashSet <string> testMethodSignatures, string symbolFilterString, string pathExtension) { using (IDiaResolver diaResolver = _diaResolverFactory.Create(binary, pathExtension, _logger)) { try { IList <SourceFileLocation> allTestMethodSymbols = diaResolver.GetFunctions(symbolFilterString); IList <SourceFileLocation> allTraitSymbols = diaResolver.GetFunctions("*" + TraitAppendix); _logger.DebugInfo($"Found {allTestMethodSymbols.Count} test method symbols and {allTraitSymbols.Count} trait symbols in binary {binary}"); return(allTestMethodSymbols .Where(nsfl => testMethodSignatures.Contains(TestCaseFactory.StripTestSymbolNamespace(nsfl.Symbol))) .Select(nsfl => ToTestCaseLocation(nsfl, allTraitSymbols)) .ToDictionary(nsfl => TestCaseFactory.StripTestSymbolNamespace(nsfl.Symbol))); } catch (Exception e) { _logger.DebugError($"Exception while resolving test locations and traits in {binary}\n{e}"); return(new Dictionary <string, TestCaseLocation>()); } } }