Commits

Matt Oswald committed 9a86d6b

commandline runner can limit the number of concurrent tests with "-c <int>"
many updates to the notes file after seeing gtest/mstest/boost test

Comments (0)

Files changed (7)

 	- ensure tests are actually ran
 	- ensure output formats
 create lib/include structure
-check Release builds for warnings
+check Release builds for warnings (and failing tests)
 can runner be made configuration agnostic? (ie, can debug runner load release tests, and vice versa?)
+filter by regex/substring matching on tests/suites(/attributes)
 
 
 Visual Studio 2012 notes
 
 Stretch
 -----
+non-fatal asserts
+would be nice to have some logging support (Log::Information("msg"))
+gtest has nice per-assert messages: Assert.Equal(a, b) << "msg"
 msbuild test runner
+GUI runner (windows only?)
 custom xUnitAsserts per assert (revisit unit tests at that point)
 support wstring as an assert call parameter
 create NuGet package/template (NuGet does not support C++ projects, yet)

xUnit++.VsRunner/xUnit++.VsRunner.cpp

         void RunFilteredTests(ITestExecutionRecorder ^recorder, bool &cancelled)
         {
             NativeReporter reporter(recorder, tests);
-            FilteredTestsRunner(0, reporter,
+            FilteredTestsRunner(0, 0, reporter,
                 [&](const xUnitpp::TestDetails &testDetails)
                 {
                     return !cancelled && std::find_if(tests.begin(), tests.end(),

xUnit++.console/CommandLine.cpp

         , veryVerbose(false)
         , list(false)
         , timeLimit(0)
+        , threadLimit(0)
     {
     }
 
                         return opt + " expects a following timelimit specified in milliseconds." + Usage(exe());
                     }
                 }
+                else if (opt == "-c" || opt == "--concurrent")
+                {
+                    if (arguments.empty() || !GetInt(arguments, options.threadLimit))
+                    {
+                        return opt + " expects a following test limit count." + Usage(exe());
+                    }
+                }
                 else
                 {
                     return "Unrecognized option " + opt + "." + Usage(exe());
             "  -e --exclude <NAME=[VALUE]>+   : Exclude tests with matching <name=value> attribute(s)\n"
             "  -t --timelimit <milliseconds>  : Set the default test time limit\n"
             "  -x --xml <FILENAME>            : Output Xunit-style XML file\n"
+            "  -c --concurrent <max ttests>   : Set maximum number of concurrent tests\n"
             "\n"
             "Tests are selected with an OR operation for inclusive attributes.\n"
             "Tests are excluded with an AND operation for exclusive attributes.\n"

xUnit++.console/CommandLine.h

         std::vector<std::string> libraries;
         std::string xmlOutput;
         int timeLimit;
+        int threadLimit;
     };
 
     std::string Parse(int argc, char **argv, Options &options);

xUnit++.console/main.cpp

             std::unique_ptr<xUnitpp::IOutput> reporter(options.xmlOutput.empty() ?
                 (xUnitpp::IOutput *)new xUnitpp::StdOutReporter(options.verbose, options.veryVerbose) :
                 (xUnitpp::IOutput *)new xUnitpp::XmlReporter(options.xmlOutput));
-            totalFailures += filteredTestRunner(options.timeLimit, *reporter,
+            totalFailures += filteredTestRunner(options.timeLimit, options.threadLimit, *reporter,
                 [&](const xUnitpp::TestDetails &testDetails)
                 {
                     return std::binary_search(activeTestIds.begin(), activeTestIds.end(), testDetails.Id);
     typedef void(*EnumerateTestDetails)(EnumerateTestDetailsCallback callback);
 
     typedef std::function<bool(const TestDetails &)> TestFilterCallback;
-    typedef int(*FilteredTestsRunner)(int, IOutput &, TestFilterCallback );
+    typedef int(*FilteredTestsRunner)(int, int, IOutput &, TestFilterCallback);
 }
 
 #endif

xUnit++/TestCollection.cpp

         }
     }
 
-    extern "C" __declspec(dllexport) int FilteredTestsRunner(int timeLimit, xUnitpp::IOutput &testReporter, std::function<bool(const xUnitpp::TestDetails &)> filter)
+    extern "C" __declspec(dllexport) int FilteredTestsRunner(int timeLimit, int threadLimit, xUnitpp::IOutput &testReporter, std::function<bool(const xUnitpp::TestDetails &)> filter)
     {
         return xUnitpp::TestRunner(testReporter).RunTests(filter,
-            xUnitpp::TestCollection::Instance().Tests(), xUnitpp::Time::ToDuration(std::chrono::milliseconds(timeLimit)), 0);
+            xUnitpp::TestCollection::Instance().Tests(), xUnitpp::Time::ToDuration(std::chrono::milliseconds(timeLimit)), threadLimit);
     }
 }