Questions tagged [boost-test]

Boost Test Library is a portable test framework for performing unit testing in c++

255 questions
314
votes
10 answers

Comparison of C++ unit test frameworks

I know there are already a few questions regarding recommendations for C++ unit test frameworks, but all the answers did not help as they just recommend one of the frameworks but do not provide any information about a (feature) comparison. I think…
housemaister
  • 3,700
  • 3
  • 17
  • 13
164
votes
2 answers

CMake: Project structure with unit tests

I am trying to structure my project to include the production sources (in src subfolder) and tests (in test subfolder). I am using CMake to build this. As a minimal example I have the following files: CMakeLists.txt: cmake_minimum_required (VERSION…
Grzenio
  • 33,623
  • 43
  • 148
  • 226
31
votes
4 answers

Unit testing non-exported classes in a DLL

We develop a C++ application using Visual Studio 2008 and unit test using Boost.Test. At the moment, we have a separate solution which contains our unit tests. Many of our projects in the core solution produce DLL's. We're limited in test coverage…
Jon
  • 8,066
  • 8
  • 43
  • 62
26
votes
2 answers

How do you specify that an exception should be expected using Boost.Test?

I have a Boost unit test case which causes the object under test to throw an exception (that's the test, to cause an exception). How do I specify in the test to expect that particular exception. I can specify that the test should have a certain…
Ferruccio
  • 93,779
  • 37
  • 217
  • 294
21
votes
6 answers

Testing for assert in the Boost Test framework

I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of my functions check the input parameters upon entry, asserting if they are…
Rob
  • 70,036
  • 53
  • 151
  • 189
21
votes
3 answers

Using Jenkins with boost.test unit tests

I have done a bit of Googling in this area and have found many discussions about getting Jenkins to understand boost.test's XML output format, but no canonical reference. Some people say we simply need to use XLST to convert the XML format, others…
Mr. Boy
  • 52,885
  • 84
  • 282
  • 517
18
votes
4 answers

Boost test linking

I want to use Boost test in my project. I use cmake in my project so I wrote a simple CMakeList.txt for wrapping it: find_package (Boost COMPONENTS unit_test_framework REQUIRED) file(GLOB_RECURSE UnitTests_sources…
Max Frai
  • 52,556
  • 73
  • 182
  • 293
16
votes
1 answer

Execute one test case several times with different fixture each time

I have a test case that I want to execute for different states of database. I insert objects to DB in fixture (and I'd like to keep it that way). I want to make method for initialization of DB virtual and specialize fixture for different…
Dino
  • 579
  • 8
  • 20
15
votes
3 answers

How can I use Boost.Test in a CMake based project?

My project uses CMake as its build system, and I want it to execute my Boost.Test test cases. How can I achieve that? In Boost.Build, I could do it as follows: import testing ; use-project /my_lib : ../src ; unit-test my_test :…
forneo
  • 715
  • 1
  • 8
  • 13
14
votes
2 answers

Can I check my program's output with boost test?

Like in: void f() { cout << "blah" << endl; } BOOST_AUTO_TEST_CASE(f) { f(); // This would be a beauty // BOOST_CHECK_PROGRAM_OUTPUT_MATCH("blah"); }
rturrado
  • 4,139
  • 4
  • 35
  • 51
14
votes
2 answers

boost.test vs. CppUnit

I've been using CppUnit for quite a while now (and am happy with it). As we are using more and more parts of the boost library I had a short look on boost.test and I'm wondering now if I should switch to boost.test in a new project or not. Can…
chrmue
  • 1,484
  • 2
  • 17
  • 29
12
votes
2 answers

Where to find the parsed Boost.Test output in Eclipse

There is already a thread here that partially answers my question . On Eclipse 3.7.2 I followed the approach provided there and I could successfully accomplish the steps creating and setting up a new error parser and adding it to my current project.…
theRelaxed
  • 121
  • 4
12
votes
2 answers

How to tell Boost.Test to stop on first failing test case?

I've got a number of Boost test cases ordered in several test suites. Some test cases have one, some more than one check. However, when executing all tests, they all get executed – no matter how many fail or pass. I know, that I can stop the…
Torbjörn
  • 4,822
  • 4
  • 44
  • 70
11
votes
1 answer

Boost.Test tests on a static library

I'm using Boost.Test for unit testing. Because of several reasons, I would like to write the unit test cases on different static libraries. The problem is that when I do this, the automatic registrar doesn't work. For instance, if I have something…
Gaston
  • 1,778
  • 2
  • 14
  • 29
11
votes
2 answers

Boost test does not init_unit_test_suite

I run this piece of code #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #include #include #include #include using namespace…
Sam
  • 18,653
  • 4
  • 53
  • 78
1
2 3
16 17