Timeline for Unit testing C++: What to test?
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23, 2017 at 12:40 | history | edited | CommunityBot | replaced http://stackoverflow.com/ with https://stackoverflow.com/ | |
| Apr 12, 2017 at 7:31 | history | edited | CommunityBot | replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/ | |
| Jul 20, 2012 at 11:14 | comment | added | futlib | @DPD: I've thought some more about this, and I think you're right, the question is what kind of tradeoff I want to make. Is it worth refactoring the whole graphic system to test a couple of entities? There wasn't any bug in there I know of, so probably: No. If it starts to feel buggy, I'll write tests. Too bad I can't accept your answer because it's a comment :) | |
| Jul 20, 2012 at 4:10 | history | edited | futlib | CC BY-SA 3.0 | deleted 7 characters in body; edited title |
| Jul 19, 2012 at 17:20 | answer | added | Dante | timeline score: 2 | |
| Jul 19, 2012 at 14:48 | answer | added | Bill Door | timeline score: 2 | |
| Jul 19, 2012 at 13:35 | history | tweeted | twitter.com/#!/StackProgrammer/status/225946945666027520 | ||
| Jul 19, 2012 at 9:41 | comment | added | futlib | That's just the kind of stuff I'd like to avoid :D I guess we C++ devs have to be especially pragmatic about testing. You did end up testing it, so I guess that's OK. | |
| Jul 19, 2012 at 9:24 | comment | added | DPD | Let me give you a recent example: I spent one whole day trying to test one singe function (written in C++/CLI) and the test tool MS Test would always crash for this test. It seemed to have some problem with plain CPP references. Instead I just tested the ouptput of its calling function and it worked fine. I wasted a whole day to UT one function. That was a loss of precious time. Also I could not get any stubbing tool suitable to my needs. I did manual stubbing wherever possible. | |
| Jul 19, 2012 at 9:15 | comment | added | futlib | @DPD: I'm not so sure, what if something is really worth testing? In the current code base, I can hardly test anything in the simulation code because it all calls the graphics functions directly, and I cannot mock/stub them. All I can test right now are utility functions. But I agree, changing the code to make it "testable" feels... wrong. TDD proponents often say that this will make all your code better in all imaginable ways, but I humbly disagree. Not everything needs an interface and several implementations. | |
| Jul 19, 2012 at 9:02 | comment | added | DPD | +1 for the difficulty in unit testing C++. If your unit test requires you to change the code, don't. | |
| Jul 19, 2012 at 7:48 | history | edited | futlib | CC BY-SA 3.0 | added 1091 characters in body |
| Jul 19, 2012 at 5:40 | history | edited | EricSchaefer | edited tags | |
| Jul 19, 2012 at 5:33 | answer | added | EricSchaefer | timeline score: 5 | |
| Jul 19, 2012 at 5:22 | history | asked | futlib | CC BY-SA 3.0 |