Boost Test Library is a portable test framework for performing unit testing in c++
Questions tagged [boost-test]
271 questions
12
votes
4 answers
Is there a way to run C++ Unit Tests tests in parallel?
I'm using Boost Test for a long time now and I ends up having my tests running too slowly. As each test is highly parallel, I want them to run concurrently with all my cores.
Is there a way to do that using the Boost Test Library ? I didn't found…

Baptiste Wicht
- 7,472
- 7
- 45
- 110
12
votes
2 answers
In Boost.Test, how to obtain the name of current test?
In Boost.Test, how can I obtain the name of the current auto test case?
Example:
#include
BOOST_AUTO_TEST_CASE(MyTest)
{
std::cerr << "Starting " << test_name << std::endl;
// lots of code here
std::cerr << "Ending "…

Frank
- 64,140
- 93
- 237
- 324
11
votes
3 answers
Visual Studio and Boost::Test
I'm getting started with Boost::Test driven development (in C++), and I'm retrofitting one of my older projects with Unit Tests. My question is -- where do I add the unit test code? The syntax for the tests themselves seems really simple according…

Billy ONeal
- 104,103
- 58
- 317
- 552
10
votes
3 answers
Boost::Test : Compiling and running a "hello world" program
I am trying to get a dummy Boost.test "hello world" program running. I found documentation here and there but obviously there is something I am missing…
Here is what I have done :
Step #1 : I installed the dependencies
sudo aptitude install…

Gael Lorieul
- 3,006
- 4
- 25
- 50
10
votes
2 answers
BOOST_CHECK_EQUAL (and dervatives) Add custom message
We recently started using the Boost Test framework, and like it so far.
However, there are certain tests where it would be great if we could add custom messages to an existing helper.
For example, I can get the output in mytest and mytest2, but have…

namezero
- 2,203
- 3
- 24
- 37
10
votes
1 answer
Get BOOST TEST test suite name inside a test case
I'm using BOOST TEST and I wonder if there is a way to find out the test suite from inside the test case. I know that I can find test case's name by:
boost::unit_test::framework::current_test_case().p_name
Is there a way to find out the suite name…

hudac
- 2,584
- 6
- 34
- 57
10
votes
2 answers
Is it possible to initialize the fixture only once and use it in multiple test cases?
Is it possible to have the fixture initialized only once and use it in multiple test cases within the same test suite? In the following example, fixture is constructed and destructed multiple times:
struct F {
F() : i( 0 ) { BOOST_TEST_MESSAGE(…
anon
10
votes
3 answers
BOOST_CHECK_NO_THROW how to get exception message printed
When I test a method using
BOOST_CHECK_NO_THROW( method_to_test() );
and an exception is thrown, it displays that an exception was thrown, but never the exception's message like this:
test.cpp(14): error in "test": incorrect exception my_exception…

550
- 1,070
- 1
- 13
- 28
9
votes
1 answer
boost test library: Multiple definition error
I'm trying to test a library that I've done (Calculus), in QTCreator for Windows.
I've created a main file, and a class in a separate file for the testing. If I compile the example found in…

Jepessen
- 11,744
- 14
- 82
- 149
9
votes
0 answers
Boost test case mixing dataset and template
I'm using boost.test for unit testing (currently using boost 1.71.0). I have a template class I would like to test with a dataset.
I could only find ways to test on different template parameters (using BOOST_AUTO_TEST_CASE_TEMPLATE) or on a dataset…

JulesW
- 156
- 6
9
votes
3 answers
How to process Boost.Test output with Eclipse
I'm using Eclipse CDT and Boost.Test(with Boost.Build).
I would like Eclipse to parse output of Boost.Test generated during by run of test suites during build.
Does anybody know how to achieve this?
Thanks in advance
user298916
9
votes
5 answers
Using boost test with Visual Studio
I am trying to use Boost Test to add some much needed unit tests to my code. However I can't seem to get it to work. Right now I have the following code
#include
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_MODULE…

Laurent Bourgault-Roy
- 2,774
- 1
- 30
- 36
9
votes
1 answer
boost test - 'undefined reference' errors
I have two simple files:
runner.cpp:
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Main
#include
and test1.cpp:
#define BOOST_TEST_DYN_LINK
#ifdef STAND_ALONE
# define BOOST_TEST_MODULE Main
#endif
#include…

Mihai Rotaru
- 1,953
- 3
- 26
- 28
8
votes
1 answer
how to organize test cases with boost::test library?
I have a project of 50+ .H/.CPP files/classes. I would like to test every class with its own test case, which will include methods for testing of different aspects of every class. My classes are located in different directories, like this:
/project
…

yegor256
- 102,010
- 123
- 446
- 597
8
votes
5 answers
Anyone have an XSL to convert Boost.Test XML logs to a presentable format?
I have some C++ projects running through cruisecontrol.net. As a part of the build process, we compile and run Boost.Test unit test suites. I have these configured to dump XML log files. While the format is similar to JUnit/NUnit, it's not quite…

Stuart Lange
- 4,049
- 6
- 24
- 30