User forums > Using Code::Blocks
Doing unit tests (cppunit)
kfmfe04:
Unfortunately, the "ugliness" is a byproduct of the fact that cxxtest generates .cpp files from .hpp files and then expects you to compile and link them. Luckily, this results in a very lightweight and easy-to-use system.
I'm not sure what is happening on your system configuration, but dependencies between projects seem to work okay for me - ie if I edit my real library code and target my test-driver application, C::B knows to compile the library before linking.
What I'd really like to see is a JUnit or NUnit like system with a GUI, but none seems to be available C++ - it's convenient to be able to run a sub-set of all the tests through a GUI when I am concentrating on something specific.
Anyhow, best not to waste too much time thinking about this - as long as the framework does its job, better to just get some framework up, and concentrate on the coding itself...
Jenna:
--- Quote from: oBFusCATed on July 06, 2009, 11:52:59 am ---Everything works fine, except that if I modify the real project the test won't recompile and rerun.
There are two options that I have:
1. Convert the test project to target in the real project (will try it tonight)
2. Somehow make C::B to recompile the test project every time I build the real project. I've tried the project dependencies dialog, but it does not work :( The thing I need is to setup the post-build step of the real project to build my test project, but I suppose that is not possible at the moment (and never will be).
--- End quote ---
What about using the C::B-project as dependency for the test-project and recompile the test-project ?
oBFusCATed:
Dependencies don't work at all, no matter if test_app depends on the plugin or the vice-versa.
Could it be because I don't link the test_app to the plugin?
kfmfe04:
From my limited experience with cxxtest and C::B (about 2 weeks), I was able to get dependencies working correctly, but it was time-consuming figuring out how to set-up a test framework to work well within C::B. When I say correctly, I mean if I edit any of my main code, a minimal-but-necessary number of compiles/links occur in my system.
As far as I can tell, C::B dependencies work fine, but settings in 3 or 4 or 5 different places can definitely have an impact on whether dependencies work the way you expect.
If you describe >very specifically<, what you mean by "Dependencies don't work at all", maybe some of us can help.
What is your setup for your code and testing framework? In the same project? In different projects? Are you using any pre-build or post-build steps for your testing framework? Is the test failing to compile or link or both?
--- Quote from: oBFusCATed on July 06, 2009, 08:36:20 pm ---Dependencies don't work at all, no matter if test_app depends on the plugin or the vice-versa.
Could it be because I don't link the test_app to the plugin?
--- End quote ---
oBFusCATed:
I've explained my setup in my first post (not very clear though, excuse me for that :( )
Here it is simplified:
1. my real project - in the current case a C::B plugin
2. my test project - do not like with the real project, because I don't export anything useful for testing. Instead I have added the files I want to test from the real project in the test project.
I've put the two projects in a workspace, then I've tried to make the test project depend on the real project (and vice versa) through "project -> properties -> project dependencies". I've not set any external dependencies, because the two output files don't depend on each other.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version