public static void CheckResults(List <TestExecutionResults> results, TestProjectRunnerArguments args) { Assert.That(results.Count, Is.EqualTo(args.Versions.Count)); for (int versionIndex = 0; versionIndex < args.Versions.Count; versionIndex++) { string projectPath = TestProjectUtil.GetProjectPath(args, versionIndex); string testsToRunFilePath = Path.Combine(projectPath, "toRun.json"); string testsToRunFileContent = File.ReadAllText(testsToRunFilePath); ToRun runInfo = JsonConvert.DeserializeObject <ToRun>(testsToRunFileContent); List <string> testsToRun = args.DependencyCollectionGranularity == DependencyCollectionGranularity.Class ? runInfo.TestsToRun : runInfo.MethodsToRun; ISet <string> runTests = args.DependencyCollectionGranularity == DependencyCollectionGranularity.Class ? results[versionIndex].ExecutedTestClasses : results[versionIndex].ExecutedTestMethods; Assert.That(runTests.Count, Is.EqualTo(testsToRun.Count), $"Number of tests run not equal in version {versionIndex}"); for (int testIndex = 0; testIndex < testsToRun.Count; testIndex++) { Assert.That(runTests.Contains(testsToRun[testIndex]), $"Test not run: {testsToRun[testIndex]} in version: {versionIndex}"); } if (results[versionIndex].FailedTestMethodsCount > 0) { // if there is some test that failed StringBuilder failedTests = new StringBuilder(); foreach (string failedTest in results[versionIndex].FailedTestMethods) { failedTests.Append($"{failedTest}\n"); } Assert.Fail($"There were failing test cases:\n{failedTests.ToString()}"); } } }
protected override string GetProjectFilePath() { return(Path.Combine(TestProjectUtil.GetTestsDirectory(args), args.Versions[currentVersionIndex], args.Versions[currentVersionIndex] + ".csproj")); }