Upon generating a Vistual Studio project from a CMake build file, CMake generates a solution with a sub-project called RUN_TESTS.vcproj that runs all unit tests as a post build action.
How can you invoke the RUN_TESTS from the command prompt using msbuild.exe?
Running msbuild RUN_TESTS.vcproj
from the build directory does not work.
Under UNIX you would do a simple make test
for Makefiles generated by CMake.
xUnit.net includes a runner which can be used from your MSBuild scripts to run unit tests. The runner is contained in the NuGet package xunit.
With -V , CTest will print out the command line used to run the test, as well as any output from the test itself. The -V option can be used with any invocation of CTest to provide more verbose output. The -N option is useful if you want to see what tests CTest would run without actually running them.
To run a single test and see how it is processed, invoke ctest from the command line providing the following arguments: Run single tst: -R <test-name> Enable verbose output: -VV.
There seems to be no way to run the tests through MSBuild.exe. You can invoke the tests with the executable ctest.exe which is part of the CMake installation:
ctest -C "Debug"
This will run the tests associated with the project's "Debug" configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With