User forums > Using Code::Blocks
Help - unit testing with Code::Blocks, WxWidgets and UnitTest++
Otto:
Hi, I'm new to C++ and C::B.
I followed this tutorial on how to set C::B and UnitTest++: http://wiki.codeblocks.org/index.php?title=UnitTesting
It worked great. Now I want to build a wxWidgets project and use unit tests there. But, in that tutorial, the main() function was used to invoke the tests. I mean, the project was exclusively to test the Leap Year.
This time the wxWidgets project has the OnInit() method, but that instantiates the Frame and the rest of the application.
I'm confused: how do I fit the call to my unit tests here? Do I need a new target? If so, how to create one?
Thanks in advance.
oBFusCATed:
If you want to debug the UI, take a look at wxTest ( http://wxtest.sourceforge.net/ ), I think the wx guys are using it themselves...
Otto:
No, I was talking about the actual code. My question is how to call the unit tests in a wx project.
But thanks for the link. Can be useful later.
killerbot:
--- Code: --- #include "UnitTest++.h"
int main()
{
return UnitTest::RunAllTests();
}
--- End code ---
What happens if you put the RunAllTests() somewhere in a method of your GUI code ?
Otto:
But somewhere, where?
I could put on the OnInit(), but that doesn't make a lot of sense, because it will run the tests, then open the GUI. I should have a way to run the tests only.
Navigation
[0] Message Index
[#] Next page
Go to full version