public void AllVerbose() { var settings = new Settings(); settings.DiscoverCommandLine = "--verbosity high --list-test-names-only *"; settings.FilenameFilter = ".*"; settings.IncludeHidden = false; // With use of "--list-test-names-only" this parameter is effectively ignored var discoverer = new Discoverer(settings); string[] sources = { Path_Hidden }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { Path_Hidden, Path_Dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); Assert.AreEqual(29, tests[0].Line); Assert.AreEqual(34, tests[1].Line); Assert.AreEqual(39, tests[2].Line); Assert.AreEqual(44, tests[3].Line); Assert.AreEqual(30, tests[4].Line); Assert.AreEqual(35, tests[5].Line); Assert.AreEqual(31, tests[6].Line); }
public void Timeout(string versionpath) { var source = Paths.TestExecutable_Dummy(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--sleep 500 --discover *"; settings.DiscoverTimeout = 200; settings.FilenameFilter = ".*"; settings.IncludeHidden = false; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(0, tests.Count); // Sanity check to see tests could be discovered with less sleep settings.DiscoverCommandLine = "--sleep 50 --discover *"; tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(1, tests.Count); }
public void AllVerbose(string versionpath) { if (versionpath.StartsWith("Rel3")) { return; // the --list-test-names-only option is not available in Catch2 v3 } var source = Paths.TestExecutable_Hidden(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var source_dummy = Paths.TestExecutable_Dummy(TestContext, versionpath); if (string.IsNullOrEmpty(source_dummy)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--verbosity high --list-test-names-only *"; settings.FilenameFilter = ".*"; settings.IncludeHidden = false; // With use of "--list-test-names-only" this parameter is effectively ignored var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { source, source_dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); Assert.AreEqual(29, tests[0].Line); Assert.AreEqual(34, tests[1].Line); Assert.AreEqual(39, tests[2].Line); Assert.AreEqual(44, tests[3].Line); Assert.AreEqual(30, tests[4].Line); Assert.AreEqual(35, tests[5].Line); Assert.AreEqual(31, tests[6].Line); }
public void LongNamesNotDiscoverable(string versionpath) { var source = Paths.TestExecutable_Discover(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--list-test-names-only NotDefaultDiscoverable*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(3, tests.Count); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[0].Name); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[1].Name); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789f123" , tests[2].Name); }
public void NoHidden(string versionpath) { var source = Paths.TestExecutable_Hidden(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--list-test-names-only"; settings.FilenameFilter = ".*"; settings.IncludeHidden = true; // With use of "--list-test-names-only" this parameter is effectively ignored var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; switch (versionpath) { case "Rel_0_1": case "Rel_1_0": case "Rel_1_1": case "Rel_1_2": Assert.AreEqual(6, tests.Count); break; default: Assert.AreEqual(2, tests.Count); break; } }
public void LongNames() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-test-names-only LongTestCaseNames*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(8, tests.Count); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[0].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[1].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[2].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[3].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[4].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[5].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[6].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[7].Name); }
public void TestGetTestsCaseNamesD() { var settings = new Settings(); settings.DiscoverCommandLine = "--discover Testset02.Tests01.*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset02 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(10, tests.Count); Assert.AreEqual("Testset02.Tests01. abcdefghijklmnopqrstuvwxyz", tests[0].Name); Assert.AreEqual("Testset02.Tests01. ZXYWVUTSRQPONMLKJIHGFEDCBA", tests[1].Name); Assert.AreEqual("Testset02.Tests01. 0123456789", tests[2].Name); Assert.AreEqual("Testset02.Tests01. []{}!@#$%^&*()_-+=|\\?/><,~`';:", tests[3].Name); Assert.AreEqual("Testset02.Tests01. \"name\"", tests[4].Name); Assert.AreEqual("Testset02.Tests01. \\", tests[5].Name); Assert.AreEqual("Testset02.Tests01. End with space", tests[6].Name); // Name is trimmed Assert.AreEqual("Testset02.Tests01. End with spaces", tests[7].Name); // Name is trimmed Assert.AreEqual("Testset02.Tests01. LongName 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[8].Name); Assert.AreEqual("Testset02.Tests01. LongName 0123456789-01234567890123456789-01234567890123456789-01234567890123456789-01234567890123456789-0123456789" , tests[9].Name); }
public void TestGetTestsManyTagsD() { var settings = new Settings(); settings.DiscoverCommandLine = "--discover \"Testset02.Tests07. Manytags\""; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset02 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(1, tests.Count); Assert.AreEqual(15, tests[0].Tags.Count); Assert.AreEqual("Manytags1", tests[0].Tags[0]); Assert.AreEqual("Manytags10", tests[0].Tags[1]); Assert.AreEqual("Manytags11", tests[0].Tags[2]); Assert.AreEqual("Manytags12", tests[0].Tags[3]); Assert.AreEqual("Manytags13", tests[0].Tags[4]); Assert.AreEqual("Manytags14", tests[0].Tags[5]); Assert.AreEqual("Manytags15", tests[0].Tags[6]); Assert.AreEqual("Manytags2", tests[0].Tags[7]); Assert.AreEqual("Manytags3", tests[0].Tags[8]); Assert.AreEqual("Manytags4", tests[0].Tags[9]); Assert.AreEqual("Manytags5", tests[0].Tags[10]); Assert.AreEqual("Manytags6", tests[0].Tags[11]); Assert.AreEqual("Manytags7", tests[0].Tags[12]); Assert.AreEqual("Manytags8", tests[0].Tags[13]); Assert.AreEqual("Manytags9", tests[0].Tags[14]); }
public void LongNamesNotDiscoverable() { var settings = new Settings(); settings.DiscoverCommandLine = "--discover NotDefaultDiscoverable*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(3, tests.Count); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[0].Name); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[1].Name); Assert.AreEqual("NotDefaultDiscoverable. a123456789b123456789c123456789d123456789e123456789f123" , tests[2].Name); Assert.IsTrue(tests[0].Filename.EndsWith(@"catch_discover\ut_notdefaultdiscoverable.cpp")); Assert.IsTrue(tests[1].Filename.EndsWith(@"catch_discover\ut_notdefaultdiscoverable.cpp")); Assert.IsTrue(tests[2].Filename.EndsWith(@"catch_discover\ut_notdefaultdiscoverable.cpp")); Assert.AreEqual(29, tests[0].Line); Assert.AreEqual(34, tests[1].Line); Assert.AreEqual(39, tests[2].Line); }
public void LongNamesNotDiscoverableVerbose() { var settings = new Settings(); settings.DiscoverCommandLine = "-v high --list-tests NotDefaultDiscoverable*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.IsTrue(discoverer.Log.Contains("Error")); Assert.IsTrue(discoverer.Log.Contains("{???}")); #if TA_CATCH2_V2_0_1 || TA_CATCH2_V2_1_0 || TA_CATCH2_V2_1_1 || TA_CATCH2_V2_1_2 || TA_CATCH2_V2_2_0 || TA_CATCH2_V2_2_1 || TA_CATCH2_V2_2_2 || TA_CATCH2_V2_2_3 || TA_CATCH2_V2_3_0 || TA_CATCH2_V2_4_0 || TA_CATCH2_V2_4_1 Assert.AreEqual(0, tests.Count); Assert.IsTrue(discoverer.Log.Contains("Line: 29")); Assert.IsTrue(discoverer.Log.Contains("Line: 34")); Assert.IsTrue(discoverer.Log.Contains("Line: 39")); #else Assert.AreEqual(1, tests.Count); Assert.IsTrue(discoverer.Log.Contains("Line: 29")); Assert.IsTrue(discoverer.Log.Contains("Line: 34")); #endif }
public void DuplicateTestname(string versionpath) { var source = Paths.TestExecutable_Duplicates(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--discover"; settings.FilenameFilter = ".*"; settings.IncludeHidden = false; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(0, tests.Count); Assert.IsFalse(string.IsNullOrEmpty(discoverer.Log)); Assert.IsTrue(discoverer.Log.Contains("Error Occurred")); }
public void LongNames() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests LongTestCaseNames*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; // Note, due to the lack of linenumber check here, // the order is different as that found in TestGetTestsCaseNamesVerbose Assert.AreEqual(8, tests.Count); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[0].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[1].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[2].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[3].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[4].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[5].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[6].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[7].Name); }
public void Names() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests *TestCases*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(12, tests.Count); Assert.AreEqual("TestCases. abcdefghijklmnopqrstuvwxyz", tests[0].Name); Assert.AreEqual("TestCases. ZXYWVUTSRQPONMLKJIHGFEDCBA", tests[1].Name); Assert.AreEqual("TestCases. 0123456789", tests[2].Name); Assert.AreEqual("TestCases. []{}!@#$%^&*()_-+=|\\?/><,~`';:", tests[3].Name); Assert.AreEqual("TestCases. \"name\"", tests[4].Name); Assert.AreEqual("TestCases. \\", tests[5].Name); Assert.AreEqual("\\TestCases. name", tests[6].Name); Assert.AreEqual("TestCases. End with space ", tests[7].Name); Assert.AreEqual("TestCases. End with spaces ", tests[8].Name); Assert.AreEqual("TestCasesLongName01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[9].Name); Assert.AreEqual("TestCases. LongName 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[10].Name); Assert.AreEqual("TestCases. LongName 0123456789-01234567890123456789-01234567890123456789-01234567890123456789-01234567890123456789-0123456789" , tests[11].Name); }
public void LongTag1(string versionpath) { var source = Paths.TestExecutable_Discover(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--discover \"Tags. Longtag1\""; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(1, tests.Count); Assert.AreEqual(1, tests[0].Tags.Count); Assert.AreEqual("Long tag 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[0].Tags[0]); }
public void LongTag2(string versionpath) { var source = Paths.TestExecutable_Discover(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--discover \"Tags. Longtag2\""; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(1, tests.Count); Assert.AreEqual(1, tests[0].Tags.Count); Assert.AreEqual("This is a long tag name, a very long tag name. Did I say it was a long tag name. Yes, it is a long tag name and it just growing and growing and growing. Where it ends, well it doesn't end here. It ends all the way over here." , tests[0].Tags[0]); }
public void LongNamesNotDiscoverableVerbose(string versionpath) { var source = Paths.TestExecutable_Discover(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "-v high --list-tests -r xml NotDefaultDiscoverable*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; if (versionpath.StartsWith("Rel3")) { // This is no longer a problem starting Catch2 v3 Assert.AreEqual(3, tests.Count); Assert.IsFalse(discoverer.Log.Contains("Error")); Assert.IsFalse(discoverer.Log.Contains("{???}")); } else { Assert.IsTrue(discoverer.Log.Contains("Error")); Assert.IsTrue(discoverer.Log.Contains("{???}")); switch (versionpath) { case "Rel_0_1": case "Rel_1_0": case "Rel_1_1": case "Rel_1_2": case "Rel_2_0": case "Rel_2_1": case "Rel_2_2": case "Rel_2_3": case "Rel_3_0": case "Rel_4_0": case "Rel_4_1": Assert.AreEqual(0, tests.Count); Assert.IsTrue(discoverer.Log.Contains("Line: 29")); Assert.IsTrue(discoverer.Log.Contains("Line: 34")); Assert.IsTrue(discoverer.Log.Contains("Line: 39")); break; default: Assert.AreEqual(1, tests.Count); Assert.IsTrue(discoverer.Log.Contains("Line: 29")); Assert.IsTrue(discoverer.Log.Contains("Line: 34")); break; } } }
public void TestGetTestsDefaultSettings() { var discoverer = new Discoverer(null); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(0, tests.Count); }
public void LongNames(string versionpath) { var source = Paths.TestExecutable_Discover(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--discover LongTestCaseNames*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(8, tests.Count); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[0].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[1].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[2].Name); Assert.AreEqual("LongTestCaseNames. a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[3].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[4].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789& f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[5].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789& i123456789b123456789j123456789k123456789l123456789" , tests[6].Name); Assert.AreEqual("LongTestCaseNames.a123456789b123456789c123456789d123456789e123456789&f123456789b123456789g123456789d123456789h123456789&i123456789b123456789j123456789k123456789l123456789" , tests[7].Name); Assert.IsTrue(tests[0].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[1].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[2].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[3].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[4].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[5].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[6].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.IsTrue(tests[7].Filename.EndsWith(@"Catch_Discover\UT_LongTestCaseNames.cpp")); Assert.AreEqual(29, tests[0].Line); Assert.AreEqual(34, tests[1].Line); Assert.AreEqual(39, tests[2].Line); Assert.AreEqual(44, tests[3].Line); Assert.AreEqual(49, tests[4].Line); Assert.AreEqual(54, tests[5].Line); Assert.AreEqual(59, tests[6].Line); Assert.AreEqual(64, tests[7].Line); }
public void TestGetTestsDefaultAll() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests *"; settings.IncludeHidden = true; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { Path_Testset01, Path_Dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); }
public void TestGetTestsNameOnly() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-test-names-only *"; settings.IncludeHidden = false; // With use of "--list-test-names-only" this parameter is effectively ignored var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { Path_Testset01, Path_Dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); }
public void NamesVerbose() { var settings = new Settings(); settings.DiscoverCommandLine = "-v high --list-test-names-only *TestCases*"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Discover }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(12, tests.Count); Assert.AreEqual("TestCases. abcdefghijklmnopqrstuvwxyz", tests[0].Name); Assert.AreEqual("TestCases. ZXYWVUTSRQPONMLKJIHGFEDCBA", tests[1].Name); Assert.AreEqual("TestCases. 0123456789", tests[2].Name); Assert.AreEqual("TestCases. []{}!@#$%^&*()_-+=|\\?/><,~`';:", tests[3].Name); Assert.AreEqual("TestCases. \"name\"", tests[4].Name); Assert.AreEqual("TestCases. \\", tests[5].Name); Assert.AreEqual("\\TestCases. name", tests[6].Name); Assert.AreEqual("TestCases. End with space ", tests[7].Name); Assert.AreEqual("TestCases. End with spaces ", tests[8].Name); Assert.AreEqual("TestCasesLongName01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[9].Name); Assert.AreEqual("TestCases. LongName 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" , tests[10].Name); Assert.AreEqual("TestCases. LongName 0123456789-01234567890123456789-01234567890123456789-01234567890123456789-01234567890123456789-0123456789" , tests[11].Name); Assert.IsTrue(tests[0].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[1].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[2].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[3].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[4].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[5].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[6].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[7].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[8].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[9].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[10].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.IsTrue(tests[11].Filename.EndsWith(@"catch_discover\ut_testcases.cpp")); Assert.AreEqual(29, tests[0].Line); Assert.AreEqual(34, tests[1].Line); Assert.AreEqual(39, tests[2].Line); Assert.AreEqual(44, tests[3].Line); Assert.AreEqual(49, tests[4].Line); Assert.AreEqual(54, tests[5].Line); Assert.AreEqual(59, tests[6].Line); Assert.AreEqual(64, tests[7].Line); Assert.AreEqual(69, tests[8].Line); Assert.AreEqual(74, tests[9].Line); Assert.AreEqual(79, tests[10].Line); Assert.AreEqual(84, tests[11].Line); }
public void AllIncludeHidden() { var settings = new Settings(); settings.DiscoverCommandLine = "--discover *"; settings.FilenameFilter = ".*"; settings.IncludeHidden = true; var discoverer = new Discoverer(settings); string[] sources = { Path_Hidden }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { Path_Hidden, Path_Dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); }
public void TestGetTestsTimeout() { var settings = new Settings(); settings.DiscoverCommandLine = "--sleep 5000 --discover"; settings.DiscoverTimeout = 2000; settings.IncludeHidden = false; var discoverer = new Discoverer(settings); string[] sources = { Path_Dummy }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(0, tests.Count); // Sanity check to see tests could be discovered with less sleep settings.DiscoverCommandLine = "--sleep 1000 --discover"; tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(1, tests.Count); }
public void TestGetTestsXml() { var settings = new Settings(); settings.DiscoverCommandLine = "--discover *"; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); }
public void TestGetTestsNameOnlyNoHidden() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-test-names-only"; settings.IncludeHidden = true; // With use of "--list-test-names-only" this parameter is effectively ignored var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(2, tests.Count); }
public void TestGetTestsDefaultTag1() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests [Tag1]"; settings.FilenameFilter = ".*"; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(4, tests.Count); }
public void TestGetTestsDefaultAllNoHidden() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests *"; settings.IncludeHidden = false; var discoverer = new Discoverer(settings); string[] sources = { Path_Testset01 }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(2, tests.Count); }
public void AllIncludeHidden(string versionpath) { var source = Paths.TestExecutable_Hidden(TestContext, versionpath); if (string.IsNullOrEmpty(source)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var source_dummy = Paths.TestExecutable_Dummy(TestContext, versionpath); if (string.IsNullOrEmpty(source_dummy)) { Assert.Fail($"Missing test executable for {versionpath}."); return; } var settings = new Settings(); settings.DiscoverCommandLine = "--discover *"; settings.FilenameFilter = ".*"; settings.IncludeHidden = true; var discoverer = new Discoverer(settings); string[] sources = { source }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); // Also check with multiple sources string[] sources2 = { source, source_dummy }; tests = discoverer.GetTests(sources2) as List <TestCase>; Assert.AreEqual(7, tests.Count); }
public void XmlReporter() { var settings = new Settings(); settings.DiscoverCommandLine = "-r xml *"; settings.FilenameFilter = ".*"; settings.IncludeHidden = true; var discoverer = new Discoverer(settings); string[] sources = { Path_Hidden }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(6, tests.Count); }
public void Tag1NoHidden() { var settings = new Settings(); settings.DiscoverCommandLine = "--list-tests [Tag1]"; settings.FilenameFilter = ".*"; settings.IncludeHidden = false; var discoverer = new Discoverer(settings); string[] sources = { Path_Hidden }; var tests = discoverer.GetTests(sources) as List <TestCase>; Assert.AreEqual(2, tests.Count); }