Home » Developing U++ » U++ Developers corner » unit testing in U++
unit testing in U++ [message #5996] |
Fri, 27 October 2006 04:16 |
exolon
Messages: 62 Registered: July 2006 Location: 53'21N 6'18W
|
Member |
|
|
Luzr mentioned that unit testing might be a future addition to U++'s arsenal.
So I guess this is as good a place as any to discuss it, having not found anything elsewhere on the forums.
A good introductory read on the state of C++ unit testing (albeit 2 years ago) is here - that guy went on to write his own testing framework, UnitTest++, since he uses test-driven design in his job. I was thrown into TDD in Java while on a work placement this Spring/Summer, and want to embrace it as much as possible in C++ with U++ if I can.
I'm not sure which approach is best, since C++ is an entirely different beast to Java. A big weakness with most testing frameworks in C++ IMO is that they don't allow mock object testing, which was truly useful in our work. Apart from that, there are a lot of good approaches...
Input welcome!
Oisín
|
|
|
|
|
|
Re: unit testing in U++ [message #6082 is a reply to message #6060] |
Mon, 30 October 2006 02:20 |
exolon
Messages: 62 Registered: July 2006 Location: 53'21N 6'18W
|
Member |
|
|
luzr wrote on Sun, 29 October 2006 17:00 |
BTW, I still have my doubts about usefulness of unit testing for GUI classes... (how are you about to detect rare visual glitches?
|
Yeah, that's a difficult case. In general, it's much easier to apply it to more logical stuff, although it's handy for test-driven design if you can mock certain calls.
About the packaging and stuff, I'm not sure. So far, I've been creating a separate project (ie: Palindrome and PalindromeTest) because I wasn't sure how to nicely separate test and tested code.. it's easier with java's package naming system and multiple source directories.
Also, running the tests means compiling all the tests into a separate executable and running that. I'm not sure how to manage that stuff properly yet...
Something like the junit test runners in Eclipse, for example, would be amazing (you select a test (or many) and hit alt-shift-X, t, and it runs the test methods, showing you a progress bar that turns red for errors or green for passes... quick and nice!).
|
|
|
Re: unit testing in U++ [message #6084 is a reply to message #6082] |
Mon, 30 October 2006 07:11 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
exolon wrote on Sun, 29 October 2006 20:20 |
Something like the junit test runners in Eclipse, for example, would be amazing (you select a test (or many) and hit alt-shift-X, t, and it runs the test methods, showing you a progress bar that turns red for errors or green for passes... quick and nice!).
|
Well, I was even thinking about something like overnight tests (test server downloads sources from versioning system, runs tests, sends report by email).
BTW, it is my impression that in fact, errors must be quite rare while testing...
Mirek
|
|
|
Re: unit testing in U++ [message #6109 is a reply to message #6084] |
Tue, 31 October 2006 06:47 |
exolon
Messages: 62 Registered: July 2006 Location: 53'21N 6'18W
|
Member |
|
|
luzr wrote on Mon, 30 October 2006 06:11 | Well, I was even thinking about something like overnight tests (test server downloads sources from versioning system, runs tests, sends report by email).
|
Well, sure. You might configure CVS to cause a build and test for every check in. Working over the summer, we had CruiseControl run continuous builds of all projects on the build server, automatically... when you checked in changes that broke anything, it'd email us, or for some of us (until we turned off notifications) send SMS to our phones
luzr wrote on Mon, 30 October 2006 06:11 | BTW, it is my impression that in fact, errors must be quite rare while testing...
|
Depends on how you code and test. With test-driven design, the way I like to code, you write a little bit of test code BEFORE that functionality exists, then run that test, confirm that it fails... then write the smallest piece of code to pass that test. Then you watch it pass, and repeat the process until you've implemented what you wanted. Usually works well for me, but some things are harder to test, of course.
About some of the GUI stuff (and more), there is some discussion of it starting here.
|
|
|
|
|
Re: unit testing in U++ [message #8066 is a reply to message #8056] |
Tue, 06 February 2007 00:15 |
ebojd
Messages: 225 Registered: January 2007 Location: USA
|
Experienced Member |
|
|
yep... in addition to having half my stuff already located over 2500 miles away (oh I forgot to add at my own expense), it cost me some things personally that cannot be judged monetarily. In the end not only did I not reapply for the post but I refused to come back even as a contract consultant. It was a sore point, but I still respect the confidentiality.
Well, enough of this off topic thread... Here's to wishing you all never experience the likes of that day!
|
|
|
Goto Forum:
Current Time: Wed Apr 24 11:45:56 CEST 2024
Total time taken to generate the page: 0.82975 seconds
|