Author Topic: Could I use CppUnit in code::blocks?  (Read 13556 times)

Offline whatx

  • Single posting newcomer
  • *
  • Posts: 3
Could I use CppUnit in code::blocks?
« on: January 24, 2008, 03:59:56 am »
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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Could I use CppUnit in code::blocks?
« Reply #1 on: January 24, 2008, 07:38:53 am »
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 ;-)

Offline Mr_LJ

  • Single posting newcomer
  • *
  • Posts: 5
Re: Could I use CppUnit in code::blocks?
« Reply #2 on: April 21, 2009, 09:15:49 pm »
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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Could I use CppUnit in code::blocks?
« Reply #3 on: April 21, 2009, 11:51:00 pm »
shame on me :-(

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

Offline Mr_LJ

  • Single posting newcomer
  • *
  • Posts: 5
Re: Could I use CppUnit in code::blocks?
« Reply #4 on: April 24, 2009, 12:26:00 pm »
Hi killerbot,

that would be great!

best regards
LJ

Offline Mr_LJ

  • Single posting newcomer
  • *
  • Posts: 5
Re: Could I use CppUnit in code::blocks?
« Reply #5 on: June 01, 2009, 02:13:48 pm »
Hello killerbot,

How do things look?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Could I use CppUnit in code::blocks?
« Reply #6 on: June 01, 2009, 03:52:14 pm »
have made some progress !!! Not completely finished yet.

Offline Mr_LJ

  • Single posting newcomer
  • *
  • Posts: 5
Re: Could I use CppUnit in code::blocks?
« Reply #7 on: September 01, 2009, 04:21:15 pm »
Hello,

how do you get ahead with the article?

regards
LJ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Could I use CppUnit in code::blocks?
« Reply #8 on: September 01, 2009, 05:05:32 pm »
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:

Code
// 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!]

Offline Mr_LJ

  • Single posting newcomer
  • *
  • Posts: 5
Re: Could I use CppUnit in code::blocks?
« Reply #9 on: September 03, 2009, 11:24:11 pm »
thanks for that instruction :D

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could I use CppUnit in code::blocks?
« Reply #10 on: September 04, 2009, 06:38:38 am »
thanks for that instruction :D
--> Isn't that something for the WiKi?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Could I use CppUnit in code::blocks?
« Reply #11 on: September 04, 2009, 01:28:08 pm »
Probably, but where to put it?
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could I use CppUnit in code::blocks?
« Reply #12 on: September 04, 2009, 09:09:54 pm »
Probably, but where to put it?
How about a new sub-section here:
http://wiki.codeblocks.org/index.php?title=User_documentation#Third-party_libraries

(Scroll down untilo you see the section "Third-party libraries ".)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ