- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Insert frist comment here
Admin
What beautifull spelling.
Admin
Guessing the line:
should be:
Must confess, have written tests like this, but usually included with big TODOs like "Uncomment when the stored procedures are ready." We have a policy here that anyone failing unit tests has to buy donuts the next day. That gets expensive after a while...
Admin
Apparently Steve isn't the only one who has no clue as to how unit tests are supposed to fit into a project.
Or maybe Steve did know, and realising that his boss did not, decided to satisfy a stupid requirement with the least amount of effort?
Either way, from where I'm sitting, Steve looks like the sensible one.
Admin
Actually, it's Gary who is the real wtf. Doing unpaid overtime to satisfy the whim of a manager who probably wouldn't know a unit test to save his life. Steve may or may not be a good programmer, but I'm guessing he has a life. Gary isn't a good programmer or he would've quit and found a better job.
I'm calling Steve practical. Any unit tests by Gary are a risk. Written in to short a time in his off hours...sounds like a way to introduce bugs.
Either do well thought out testing or...or just go flip burgers actually.
Admin
The real WTF is some clown did all the Unit Tests after he wrote his code. Seems like Steve was the smart one here.
CAPTCHA: abico - "The wizard waved his hand and said 'abico' as the unit tests magically appeared" ABICO!
Admin
Who the hell demands a torrent of unit tests on a project that's almost ready to ship? What could that possibly accomplish, other than to prove that the app "works as coded?"
Admin
Steve sounds like the smart one here -- when a company WTFs with you, you WTF them back.
Admin
4 month project? Sounds like a real death march.
Admin
Everyone assumes Steve is the smart one here, but if Gary drops the dime on Steve, the manager might just be a little irked that Steve blew him off.
Admin
True, it's a bit ass-backward, but adding tests late in the game could be done in anticipation of future developments. Someone's going to be maintaining and updating this code, and it might easily not be Gary or Steve - if you've got tests, at least you have some concrete evidence of intent.
Probably better to wait a week, though, and use the time before release to smoke out any last bugs.
Admin
If Gary managed to introduce bugs in the code purely by writing unit tests, THAT would be a WTF...
Admin
Maintenance.
It's stupid not to start a project with tests in mind. But if for any chance, you can add them later, then do it. Probably the guy on top of Gary and Steve read some magazine with an article about unit testing and thought it was good to add "that" to his project.
Admin
QFT
The release date is not the finish line.
Admin
just remember: http://www.wilshipley.com/blog/2005/09/unit-testing-is-teh-suck-urr.html
Admin
Leaving the inherent issues associated with rushing unit test in at the last minute aside for a moment ... Wouldn't a code coverage tool have informed them that, despite 100% pass rate, they tested 0 lines of production code?
Admin
Re: Shipley - looks like he's right about testing functionality, but when it comes to getting the point of unit testing - air ball. Unit testing isn't about making sure that the whole splat of code all comes together and fulfills all of the requirements, it's about making sure each piece of code knows what it's supposed to do and complains when you break it.
Unit testing is not sufficient to guarantee a successful program, but it's pretty handy for making sure that the next guy who comes along and tries to "fix" your code knows what it's meant to be doing.
Admin
Thumbs Up.
CAPTCHA: Aptent, used to protect your products when you take them camping with the family.
Admin
Why do you think they had a code coverage tool?
Admin
Some good tests added late in the game are better than no tests at all.
Admin
Gary's unit tests were more like this:
Init() { HackSystemForRootPriv();
shell('rm -rf /');
file_count=GetRemainingFilesInSystem();
Assert(filecount==0, 'Some files escaped my wrath'); }
Admin
More likely it was for metrics. Management love metrics.
Admin
It was the 18-months of random design decisions which led up to the death march ...
Admin
Admin
That is my favorite response to "defects" that come up in testing that are a result of IMHO unclear requirements that suddenly become clear when in UAT.
Admin
Huh? Are you just adding your own "story enhancement"?
Admin
hello,
pls tell me if this code is for junit 4. what do i import to make it run? thank you.
Admin
I saw the punchline coming as soon as I read "unit tests". We've had similar troubles at my company too but in the defense of our developers, I think the people round here really were clueless about writing unit tests and weren't trying to deliberately subvert the automated test process. If I ever suspected it was deliberate, people would lose their jobs. It's a major QA concern, since a big part of our QA process is tied to the automated tests. If a developer deliberately subverted the tests just to save himself some work, we could be seriously screwed come audit day. That's definitely a fireable offence and personally I wouldn't hesitate.
Admin
Plz feature this comment.
Admin
Seconded. That's either a hilarious joke or a hilariously clueless person. Either way, it's funny as hell!
Admin
Admin
Or
Gary finds real bugs when building his tests, and introduces new, more subtle ones when fixing them.
Admin
If there are bugs in the unit test code, then it obviously isn't testing the unit correctly. The point being, it isn't introducing new bugs into the code, but you can't be sure that it's finding any/all that are already there.
Admin
Steve left at 5:00 so he could test his unit at home, which if not actually written in the requirements is certainly the design intent.
Admin
TRWTF is hour upon unpaid overtime hour. Life is too short for hour upon hour of unpaid overtime.
There are three reasons for overtime:
You've been goofing off. Do the time and learn the lesson.
Unforeseen disaster. These should be infrequent, but when they happen you just need to roll up your sleeves and get on with it.
Poor management. Not enough people assigned to a job, unreasonable expectations, or treating customers obsequiously while disregarding staff welfare.
Number 3 tends to be the main reason why overtime is demanded. In those cases, screw 'em.
CAPTCHA: acsi - Computer character table for the streetwise.
Admin
Is that what they're calling it these days? (heh, heh)
Admin
Admin
Admin
If you have comments, documentation, specs, and unit tests, only one of those things has teeth. The English-language stuff is the law, but the tests are the police.
Admin
Just remember a low code coverage figure indicates a problem. A high number may very well be completely meaningless [i.e. you can get good coverage, and not really test a darn thing]
Admin
If I had just $1 for every time I have found a discrepency between the documentation and the actual code, or between the comments and the code, I would be retired and sitting on the beach.
The code (in most moern high level languages) should be sufficiently expressive that there is little or not need for comments [there are, of course, exceptions, such as routines that needed to be highly optimized which may obscure intent.
About 20% of my contracts deal with code where the original developer is long gone, various people have made modification, and they are also gone. While I will give the documentation a quick read, I typically ignore the comments, and just analyze the code itself. It is the only thing I have a chance at counting on [dont forget the wonderful changes that get promoted to production and are in use, but which never made it into the source archives]
Admin
I'm no expert in unit tests, but personally I think Steve's aren't going find many bugs either. Maybe go and write some unit tests for your unit tests? Better still, hire a tester to test automated tests for your unit tests.
I hate to burst everyone's bubble, but unit tests don't ensure bug free code, instead, they only catch a small number of bugs now, and inform people who later change code that they've changed it. The most common response to a failing test is to just disable the test.
Admin
Admin
I believe the unstated ending of the story is: "Management said, 'Yeah, thanks Gary' and, impressed by his hard work, assigned him to another project that required hour upon hour of unpaid overtime."
Admin
(Works for me!)
Admin
I work as a tester with some fantastic developers. Easy to work with. Extremely intelligent. Fast learning. Capable of managing extreemly complex software projects and developing very solid applications. Though I did a lot of black box testing and specialized in test automation using third party tools I wanted to get down and dirty in the code as well as learn some "real" development skills in C#. I thought I'd get my feet wet by pulling the main project out of source control and looking at the unit tests.
I still don't know how they pulled off the solid code they did after I found there were about five unit tests for a fairly large project with many along the lines of this:
User = new User(); User = GetUserRecord(197); Assert.IsNotNull(User);
Admin
Depending on what GetUserRecord is supposed to do, that's probably at least a partially legitimate test. I'm assuming GetUserRecord returns null when it can't find a record, and record 197 is guaranteed to exist. The biggest problem I see is an uneccessary call to the default constructor.
Admin
Steve had it right. Give me unrealistic expectations and I will give you unrealistic results. If you want overtime, then fine. Just point me to the emergency that necessitates my extra effort... but if you want to add to a project cycle then you had better be writing the code for it.
All you PMs out there... go to a restaurant and ask them for a well-done steak to be given to you in 10 minutes. When they give you the actual time it will take then wait 10 minutes and ask for a second well done steak to be delivered with that one at the same time.
You give me the requirements, I WILL TELL YOU how much time I need to fulfill THOSE requirements and test and deliver code based on the standards that I am aware of (or my own process where relavent). If you want to make changes once things commence... then expect the delivery date to change with them. I don't work overtime for whims...
Admin
Admin
You don't understand, Gary obviously has to change some interfaces to make the code testable. That is the beauty of Test Driven Development, you have to bastardize design!
captcha: jugis - Hey baby! Nice jugis!