Boost logo

Boost Users :

From: Plonka Christian (christian.plonka_at_[hidden])
Date: 2008-01-16 07:14:03


Hi Ovanes,

 

I found the problem. The console_test_runner and my NetCtrld.dll used different boost_unit_test_framework-....dll's. So I had two different master test suites, one in each DLL. Now it seems to be working.

 

Thanks,

Christian

 

________________________________

Von: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] Im Auftrag von Ovanes Markarian
Gesendet: Dienstag, 15. Jänner 2008 18:40
An: boost-users_at_[hidden]
Betreff: Re: [Boost-users] Boost.Test Framework to test a DLL

 

Is there any chance that Boost.Test can not load (find) your DLL? Try to copy console_test_runner into the directory which contains your DLL? Debug DLLs under VC++ have usually a suffix 'D' before .dll. The letter NetCtrl->d<-.dll is probably this suffix. If not, add it, so that the name is NetCtrldD.dll

With Kind Regards,
Ovanes

On Jan 15, 2008 9:55 AM, Plonka Christian <christian.plonka_at_[hidden]> wrote:

Hi,

I'm planning to change from CppUnit to Boost.Test for unit testing since
it is now possible to integrate unit tests also in a DLL. Nevertheless I
do encounter some problems here.

The code is (I guess you'll recognize it):

//----------------------------------------------------------------------

---
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp> 
using namespace boost::unit_test;
BOOST_AUTO_TEST_CASE( test1 )
// void test1()
{
   int i = 0;
   BOOST_CHECK_EQUAL( i, 2 );
}
BOOST_AUTO_TEST_CASE( test2 )
{
   BOOST_CHECKPOINT("About to force division by zero!"); 
   int i = 1, j = 0;
   i = i / j;
}
extern "C" {
__declspec(dllexport) bool
init_unit_test()
{
   printf("Initializing\n");
   framework::master_test_suite().p_name.value = "Test runner test"; 
   // framework::master_test_suite().add( BOOST_TEST_CASE( &test1 ) );
   return true;
}
}
//----------------------------------------------------------------------
---
I the sample (test_runner_test.dll) it works fine but when I use it in 
my DLL I get:
C:\Projekte\Test\NetControl\bin>console_test_runner --test NetCtrld.dll
Initializing
Test setup error: test tree is empty
I also tried the commented version using master_test_suite().add() 
without any change.
Any hint what I can try or how I can debug this?
Thanks,
Christian
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net