News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Could I use CppUnit in code::blocks?

Started by whatx, January 24, 2008, 03:59:56 AM

Previous topic - Next topic

whatx

I want to make unit test in code::blocks,
Is there convinent way to plug CppUnit into the IDE.
Or is it support some other test framework?
Thanks a lot

killerbot

HI,

I think you should be able to use it.
I myself am using : UnitTest++ http://unittest-cpp.sourceforge.net/.
It is a very good framework.

I will write an article about it, you can run the tests as post build steps and when a test fails you can click in the build messages list to jump to the failing test.

Just give me a few days to write the article ;-)

Mr_LJ

Hello,

I would like to use CppUnit with Codeblocks as well (or perhaps UnitTest if it's easier to make it work).
Is there any article about it by now?

best regards
L J

killerbot

shame on me :-(

Will try to do it in the coming weeks  :oops:

Mr_LJ

Hi killerbot,

that would be great!

best regards
LJ

Mr_LJ


killerbot

have made some progress !!! Not completely finished yet.

Mr_LJ

Hello,

how do you get ahead with the article?

regards
LJ

oBFusCATed

Tutorial for unittest++:

0. Read the docs first :lol: at http://unittest-cpp.sourceforge.net/UnitTest++.html
1. Create console project
2. Change the code in main.cpp to look like this:


// test.cpp
  #include <UnitTest++.h>

  TEST(FailSpectacularly)
  {
    CHECK(false);
  }

  int main()
  {
    return UnitTest::RunAllTests();
  }

3. Add the include paths to the unittest++
4. Add linking options
5. Compile and run it...
6. If errors goto 3/4
7. Add a post build step for the test project to run the resulting executable
8. Write you tests and have fun.

If you know how to setup projects with codeblocks you won't have problems with this.

Best regards
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Mr_LJ


MortenMacFly

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

MortenMacFly

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]