Home > Archive > Extreme Programming > September 2007 > CppUnit add-in class generator for ms visual studio 2005 .NET ??
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
CppUnit add-in class generator for ms visual studio 2005 .NET ??
|
|
|
| hi there
I've started using cppunit to write my test cases for my native C++
project.
And I am wondering if anyone have created an add-in for visual studio
2005,
to add the h and cpp file, for a test class ?
| |
| Phlip 2007-09-03, 10:03 pm |
| xxx wrote:
> I've started using cppunit to write my test cases for my native C++
> project.
Did you write the project _before_ starting these test cases?
> And I am wondering if anyone have created an add-in for visual studio
> 2005,
> to add the h and cpp file, for a test class ?
Note a few important things here:
CppUnit underrepresents the Test Collector Pattern. UnitTest++ does that
much better, following CppUnitLite. All you write to case your test is:
TEST(something)
{
assemble();
int x = activate();
assert_equal( 42, x );
}
The test rig handles all the mucky-muck of adding 'something' as a test case
to a nearby test suite. CppUnit, in its default configuration, requires too
much busy-work there.
Next, not every class in C++ must have a matching .h file. Because nothing
should export your test classes - even CppUnit's default classes - you could
leave them hidden in their .cpp files and only register them with the test
runner.
Next, Test _Driven_ Development is not about automatically generating test
cases - regardless what certain Visual Studio verbiage would lead one to
believe. TDD is about maximum bang running tests, for minimal buck writing
tests. If you find you spend too much time writing test infrastructure -
with or without Test Collectors - then you might be doing something wrong.
All this works much better when you write the tests first. If I had a
freshly-started project, without tests, I would just start again, this time
test-first, using the existing code as a cheat-sheet. The result is _always_
better than a retrofit.
--
Phlip
http://www.oreilly.com/catalog/9780596510657/
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax
|
|
|
|
|