Boost Test Library is a portable test framework for performing unit testing in c++
Questions tagged [boost-test]
271 questions
8
votes
2 answers
GCC Address Sanitizer - blacklisting library functions (specifically boost::test)
All of my unit-test code is based around boost::test. I have just tried the GCC Address sanitizer and it reports some issues with boost::test:
==25309==ERROR: AddressSanitizer: heap-use-after-free on address 0xf5801344 at pc 0x8259412 bp 0xff9966c8…

mark
- 7,381
- 5
- 36
- 61
8
votes
2 answers
Running unit tests from Atmel Studio 6
I am currently developing an embedded c++ project in Atmel Studio 6. This project has a fairly significant embedded portion and also a significant business logic portion. Ideally I would like to run some unit testing for the business logic code.…

shuttle87
- 15,466
- 11
- 77
- 106
8
votes
2 answers
repeat testcase in Boost test multiple times
Is there a way to repeatedly run a unit-test or a set of unit-tests in Boost test?
Let say I have the following:
BOOST_FIXTURE_TEST_SUITE(someSuite, someFixture)
BOOST_AUTO_TEST_CASE(someTest)
{
...
}
BOOST_AUTO_TEST_SUITE_END()
... and I'd…

marton
- 81
- 3
7
votes
0 answers
Cannot see boost unit test namespace and class names in Visual Studio test explorer window
I'm developing a CMake project in Visual Studio 2019, and I want to perform unit testing with boost::test by using the Visual Studio Test Explorer.
I've the following CMakeLists.txt that defines a boost unit test project for some…

Jepessen
- 11,744
- 14
- 82
- 149
7
votes
2 answers
Boost.Test error messages are no more shown in error list of VS2010
I am using Boost.Test Unit Test Framework for native C++ projects. All is working fine, but I've got one issue after upgrading to Visual Studio 2010: The messages about failed tests are no more shown in the error list after the tests ran as a post…

Paul Michalik
- 4,331
- 16
- 18
7
votes
3 answers
comparing QTest with other frameworks
Can you compare popular unit test frameworks for C++ with QTest of Qt?
(cppunit, boost test, google test etc..)
What are the advantages disadvantages?
Thank you.
note: GUI test is not very important for us.

trante
- 33,518
- 47
- 192
- 272
7
votes
5 answers
Use enum classes with Boost Test
I have an enum class that I would like to use in my unit tests:
enum class MyEnumClass
{
MyEntryA,
MyEntryB
};
I would like to use it as follows:
MyEnumClass myEnumValue = MyEnumClass::MyEntryA;
BOOST_CHECK_EQUAL(myEnumValue,…

ValarDohaeris
- 6,064
- 5
- 31
- 43
7
votes
1 answer
Boost unit test: adding a helper method or private function
I have a BOOST_AUTO_TEST_CASE which needs a helper function. I could just make this a regular function and call it from within; but I'd rather somehow keep it local and private to the scope of the BOOST_AUTO_CASE. I'd also like to be able to…

SRobertJames
- 8,210
- 14
- 60
- 107
7
votes
1 answer
Running Boost unit tests on different processes
I want to do unit testing in a SystemC program. The idea is to have multiple test suites with several tests in each suite. Each one of the tests would require resetting the SystemC framework (e.g., by calling sc_simcontext::reset()), but that is…

betabandido
- 18,946
- 11
- 62
- 76
7
votes
2 answers
CMake: how to add Boost.Test cases with relative directories?
I have a working project with CMake and Boost.Test with a directory structure like this (pardon the ASCII art):
+-proj
|---CMakeLists.txt
|---build
|---test
|\----dir1
| \----foo.cpp // contains one BOOST_AUTO_TEST_SUITE and several…

TemplateRex
- 69,038
- 19
- 164
- 304
7
votes
2 answers
Boost Test: How to write parameterized test cases
I've got a boost test case. Most lines of this test case are executed regardless of the parameters. But there are parts which are executed based on the provided parameter. I want to avoid writing two separate test cases which are almost identical…

B Faley
- 17,120
- 43
- 133
- 223
7
votes
3 answers
BOOST_CHECK_EQUAL with pair and custom operator <<
When attempting to do a BOOST_CHECK_EQUAL(pair, pair),
gcc doesnt find the stream operator for pair, inspite of declaring it.
The funny thing is that std::out finds the operator.
ostream& operator<<(ostream& s, const pair& p) {
s << '<'…

nishantjr
- 1,788
- 1
- 15
- 39
6
votes
4 answers
boost-test initialization for each suite (not case)
I need to init some variables, which are "global" inside a BOOST_AUTO_TEST_SUITE
so their constructors will be called when the suite starts and their destructors will be called right after the last corresponding BOOST_AUTO_TEST_CASE is finished
does…

Alek86
- 1,489
- 3
- 17
- 26
6
votes
3 answers
Memory leak detection with boost::test
I try to enable msvc memory leak detection with line number like this snippet I found here:
Detected memory leaks!
Dumping objects ->
C:\PROGRAM FILES\VISUAL STUDIO\MyProjects\leaktest\leaktest.cpp(20) : {18}
normal block at 0x00780E80, 64 bytes…

schoetbi
- 12,009
- 10
- 54
- 72
6
votes
1 answer
Boost's data-driven tests' join operator `+` corrupts first column
Consider the following code:
BOOST_DATA_TEST_CASE(
sampleTest,
(data::make(1) ^ data::make(2)) + (data::make(3) ^ data::make(4)),
var1,
var2)
{
std::cout << var1 << "," << var2 << std::endl;
}
The output I expect…

Addy
- 2,414
- 1
- 23
- 43