in GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs [36:88]
public IList<TestCase> CreateTestCases(Action<TestCase> reportTestCase = null)
{
List<string> standardOutput = new List<string>();
if (_settings.UseNewTestExecutionFramework)
{
return NewCreateTestcases(reportTestCase, standardOutput);
}
try
{
var launcher = new ProcessLauncher(_logger, _settings.GetPathExtension(_executable), null);
int processExitCode;
string workingDir = new FileInfo(_executable).DirectoryName;
standardOutput = launcher.GetOutputOfCommand(workingDir, null, _executable, GoogleTestConstants.ListTestsOption,
false, false, out processExitCode);
if (!CheckProcessExitCode(processExitCode, standardOutput))
return new List<TestCase>();
}
catch (Exception e)
{
SequentialTestRunner.LogExecutionError(_logger, _executable, Path.GetFullPath(""),
GoogleTestConstants.ListTestsOption, e);
return new List<TestCase>();
}
IList<TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_settings.TestNameSeparator).ParseListTestsOutput(standardOutput);
var testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _settings.GetPathExtension(_executable));
IList<TestCase> testCases = new List<TestCase>();
IDictionary<string, ISet<TestCase>> suite2TestCases = new Dictionary<string, ISet<TestCase>>();
foreach (var descriptor in testCaseDescriptors)
{
var testCase = _settings.ParseSymbolInformation
? CreateTestCase(descriptor, testCaseLocations)
: CreateTestCase(descriptor);
ISet<TestCase> testCasesInSuite;
if (!suite2TestCases.TryGetValue(descriptor.Suite, out testCasesInSuite))
suite2TestCases.Add(descriptor.Suite, testCasesInSuite = new HashSet<TestCase>());
testCasesInSuite.Add(testCase);
testCases.Add(testCase);
}
foreach (var suiteTestCasesPair in suite2TestCases)
{
foreach (var testCase in suiteTestCasesPair.Value)
{
testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasesPair.Value.Count, testCases.Count));
}
}
return testCases;
}