2

I am just starting to work with QuantLib project. There are quite a few BOOST unit tests defined, hence the question: is there an easy way to run these tests selectively from Visual Studio (and see results)?

I've only used unit testing in .Net languages so far, and there you can either use the built-in test runner if you use MsTest, or some add-on (I used Resharper and TestDriven.NET) for other frameworks. There you can choose which tests you run, and you can run them with the debugger attached (which is unfortunately useful sometimes). Are there similar add-ons for BOOST tests in unmanaged C++?

3
  • You can run and debug a Boost::test application like a normal executable. Also, I also found useful to have the tests run as a custom post build step (the results show up nicely in the output window of VS). Dec 18, 2012 at 14:28
  • @AlexandreC., I think they did set it up as a post-build step as well. Can I run selected tests (i.e. the ones I am currently working on) only though?
    – Grzenio
    Dec 18, 2012 at 14:31
  • 1

4 Answers 4

4

Yes you can!

If your boost unit test project is defined correctly, then you can run the entire test project from VS10 debugger by clicking

right click on project --> Debug --> Start new instance

This will run the tests inside VS framework which will give you all the debugger goodies.

For running specific test suites/cases, just edit the project command line arguments under

right click on project --> Properties --> General --> Debugging

and add the parameters according to the links in the other answers

3

you can run any test case or test suite via command line. running tests by name

it even allows wildcards.

2
  • Nice. Is there any GUI add-in for VS to automate the process?
    – Grzenio
    Dec 18, 2012 at 14:48
  • no, just the VS onboard project properties dialog. just add $(TargetPath) as custom post build event and you will be pointed to the failing tests in the output window (and error list). if you do not want to run all tests you have to name the tests/suites. by nice naming you may run multiple suites of your own via wildcard.
    – stefan
    Dec 18, 2012 at 14:59
1

ReSharper C++ supports discovery and selective running/debugging of Boost tests (with Boost 1.59 and later).

0

I'm using the Boost Unit Test Adapter. It's free and has a very nice output. It can also list the time the single tests consumed and you can start single tests and group of tests.

You can download it here:

https://visualstudiogallery.msdn.microsoft.com/5f4ae1bd-b769-410e-8238-fb30beda987f?SRC=VSIDE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.