JUnit bible thumpers
It’s fairly impressive how unit testing seems to have grabbed a number of java developers by the balls, and made them sing in surprisingly high voices.
Of course, we all know the virtues of unit testing. It’s great, it lets you err…test your little unit of code. It lets you pretend you don’t need any QA engineers, and rewards you with nice green bars (or ascii dots, if you’re into that sort of thing) that seem to have a disturbing sexual appeal to far too many people.
What is surprising though is the religious aspect of it. For example, some comment on a blog a few weeks back had someone spouting shite like ‘well I’m not a zealot or anything, but I would never use code with no unit tests, it works by accident not design’. What’s particularly sickening about this is the fuckfaced disclaimer up front. It puts the whole thing right up there with such gems as ‘Well I’m no racist but those niggers…’ and ‘I’m no bible thumper but YOUR ALL BURNING IN HELL YOU GODDAM ABORTION LOVING BABYKILLERS’ (Note: The typo is deliberate).
Surprisingly, the developer world hobbled along quite successfully before junit. Huge portions of it keep on hobbling that way with astounding success. See, what people seem to have forgotten is that a unit test does not mandate junit. It’s the approach that matters. Coverage reports are there to make things more sexually stimulating, they’re NOT a fundamental part of the approach. You could have plenty of unit tests that are nothing more that main methods in your various implementation classes. That still has its value, and certainly is more useful than no tests at all.
The JUnit fetishists are the freakiest of them all. What’s impressive is that they’ve invented this whole new universe just to justify what a horrifically broken tool they’ve staked their careers on (yes thoughtworks fuckstains, I’m pointing and laughing at you, you dirty chozgobbling rumprangers). Need static initialisation for shared or expensive resources? Not possible in Junit! Therefore, it’s evil! if you need to do it you’re broken!
The same goes for anyone who ever expresses any need for something beyond one method one test. Why the religious zealotry here? We all write code every day that requires more than one method, so why can’t our tests function similarly? Why is it so unthinkable that there might be some element of good unit testing that are not fully captured by JUnit?
The sickest joke in all this is how badly JUnit itself is written. Just read some of the javadocs and inline comments, they make it fairly clear that a fairly liberal amount of drugs had been imbibed in the course of writing it all.
So I ask you, all of you who want nothing more in life than to bend over and have JUnit plug all your orifices, why? What do you get out of it? Why this sickening allegiance to a flawed, old, unmaintained, and dysfunctional tool?
Update
: In my fury at junit, I forgot to mention my shameless plug. If you’re a JCP member, vote for me in the EC elections! If you aren’t, join then vote for me. I’m the only nominee who is motivated purely by improving Java. Everyone else is there out of some business need or corporate agenda. Stick it to the man!
November 10th, 2004 at 12:35 pm
What’s your point? Solution? Answer? Anything?
November 10th, 2004 at 12:42 pm
It’s a _BILE_ you dumbass, it’s supposed to point out a problem, not propose a solution.
November 10th, 2004 at 1:12 pm
I would like to see a list of similar (read better) tools for Unit testing.
November 10th, 2004 at 1:24 pm
Yeah, somethings seriously screwed with the API of JUnit, add to that the problem you have when you want to extend it to do something useful and all the tool tool writers have tied themselves in at the wrong level..
Add to that the copious amounts of harness code you need to write JUST to stop yourself from going postal trying to write a simple test.
I think junit’s one of those things people like to say that it’s useful, but at the end of the day we need something a lot better (perhaps agitar or something along those lines).
November 10th, 2004 at 1:25 pm
Huh? Of course you can test more than one method call per unit test method. Of course static initialisers are a bad idea. Of course expensive and static initialisers that might fail are a terrible idea. It looks like you don’t like JUnit because it gets in the way of your awful coding style, but that can’t be the case, can it? Can it?
November 10th, 2004 at 1:44 pm
9 days between biles is a bit too long .. please don’t let that happen again
November 10th, 2004 at 2:02 pm
It’s unfortunate, but it seems Hani has missed the whole point of the unit-testing movement. You are especially way off when you start spewing about Junit being revered. It’s popularity is due to it’s ubiquity and that’s about it. I mean.. the tool barely does anything by itself. If you are trying to unit test any system more complex than a high school project, your gonna have to build on top of JUnit extensively and threw in some other frameworks. As well, I don’t think anyone proposed to replace QA engineers with JUnit unit tests. Perhaps, you need to take a good hard look again at what and how people are using JUnit.
November 10th, 2004 at 2:15 pm
Can I press a button in my IDE and clearly see whether or not all of your main methods “pass”? I didn’t think so. JUnit isn’t perfect but everyone knows how to use it and it’s integrated into most IDEs and build tools.
You should have mentioned the mysterious exception handling. If you don’t catch Exception somewhere and print to stderr you don’t get much feedback at all.
November 10th, 2004 at 2:22 pm
Get doctest and relax
http://c2.com/cgi/wiki?DocTest
November 10th, 2004 at 2:29 pm
I think it’s stupid stuff like this that the good man is talking about:
http://www.theserverside.com/news/thread.tss?thread_id=29114
I don’t need a fuckface telling me bullshit like that. This is the real world where real work needs to get done.
November 10th, 2004 at 2:35 pm
Artima’s SuiteRunner seems like a much improved version of JUnit; I wish someone would cut-n-paste Eclipse’s JUnit support to create SuiteRunner support. I can’t live without my green bar (and my usefully filtered stack traces, and an easy way to re-run failed tests, etc.).
November 10th, 2004 at 2:38 pm
Hani’s Bile Etiquette prevents him from giving a solution to his bile, but I’m not stopped by such ludicrous moral conduct.
The solution is, of course, TestNG, which will soon be available for JDK 1.4 as well. http://beust.com/testng
November 10th, 2004 at 3:01 pm
Pretty pathetic this time, Hani
November 10th, 2004 at 3:34 pm
I agree, JUnit is crap. It has very limited application. I’m not knocking testing your code, I’m just saying that JUnit for me is not a workable solution for anything more complicated than testing some static helper methods. Almost
everything that I have ever wanted to test, executes in some context. Don’t tell me that ‘setup()’ and ‘tearDown()’ is there to define context, because it’s a crap way of doing it. Any state that I want to associate with the test, needs to be fetched from some singleton abortion, which is there purely to hack your way around a how a unit test gets constructed.
Wie’s jou pa klein hondtjie!
November 10th, 2004 at 3:52 pm
“The typo is deliberate”
As far as I can tell, you spelled “niggers” correctly.
November 10th, 2004 at 4:00 pm
Finally a bile about JUnit. I requested this almost a year ago on December 31st. Ask, and you shall receive.
Anywho, Hani’s right on this one. People actually design to fit JUnit. How incredibly stupid is it to make your design fit your tool?
“Nail, meet Hammer.”
“Oh, you’re not a nail? Well, better make you into one then.”
November 10th, 2004 at 4:57 pm
I like the way Maven runs all my JUnit tests after compiling the code. Oops, did I just admit to being an asshat?
November 10th, 2004 at 6:24 pm
No fucking way are you getting on EC, whatever the fuck that is, asshole.
November 10th, 2004 at 7:35 pm
I see Cedric didn’t resist much and announced TestNG support for JDK 1.4. Yep, it will come out very soon indeed.
November 10th, 2004 at 7:38 pm
“chozgobbling rumprangers” heh.
November 10th, 2004 at 7:52 pm
I don’t think James Gosling would use any of those words on any post. He is a very intelligent human being, and Canadian. So whoever is trying to pretend to be James Gosling. “No fucking way are you going to fool us, asshole.”
November 10th, 2004 at 7:53 pm
ek is jou pa
November 10th, 2004 at 8:28 pm
Unit testing saved my ass several times when refactoring. And JUnit just provides a minimal framework for writing the tests. Whine on pimple faces!
November 10th, 2004 at 10:20 pm
While it’s true that I’m intelligent and canadian, there’s more to the story than that. When I was young, my entire family was wiped out in a freak snowshoeing accident. Subsequently, I was raised by wolves for the next 9 years of my life. After emerging from the wilderness and learning English, Pascal and C++, I toured the underground canadian cage fighting circuit, vanquishing such foes as Andre the Giant, RMS and an entire squadron of fat balding jordanian pilots. One fateful night, as I was pounding the living piss out of a wimpy academic LISP programmer, a particularly drunk, rabidly drooling sloth introduced himself to me in between heaves of vomit as John Schwartz. He then proceeded to slip roofies in my drink, and when I awoke, he had shaved of all of my chesthair and had me tied to a bed. He said that the only way he would let me go was if I went to go work for him at his computer company. Being a caged animal, I complied. So you can see, I have a perfectly good reason to curse like a fucking sailor and you can take your snooty comments about canadians and shove them up your ass.
November 11th, 2004 at 12:30 am
JUnit does have its share of problems as I also mentioned in my blog on 8/0/04 http://blog.taragana.com/index.php?p=56
I found a way to get around the limitation of one-test-per-method.
As always Cedric rapidly comes to the rescue of anyone posting woes of JUnit with reference to his tool NGUnit :)
I did play around a bit with NGUnit. I like the ability to make any method a test method and the lack of requirement to extend/implement some class/interface. The xml way of specifying tests leave much to be desired and takes away much of the simplicity of other features. The grouping and sub-grouping features surely didn’t listen to YAGNI thoughts :) More on it later, maybe in a blog.
November 11th, 2004 at 12:54 am
Ward invented the wiki. Kent and Ward invented JUnit. Pretty successful ideas.
You can’t even get ‘asshat’ catch on.
November 11th, 2004 at 4:06 am
You got my Vote..you deserve it :)
November 11th, 2004 at 4:56 am
Anonymous: the real issue is not JUnit or Kent & Ward. The real issue is that JUnit has (technologically) made its time, that JUnit is not the “only true Unit Testing solution”, that JUnit is NOT the “only way to acquire salvation”, that Unit Testing by itself covers only ONE aspect of development therefore all the fetishism is lost.
If you read carefully the bileblog, you will see that Hani puts fetishisms in the first place of hatred.
November 11th, 2004 at 5:48 am
Let’s just kill Martin Fowler and get it over with. Put a bead into his baldy noggin and end all this torment.
November 11th, 2004 at 8:12 am
I just love the language. Except JBoss related biles, when it seems Hani’s tongue became too tangled because of excessive anger, it’s simply brilliant.
Hani, you are my Jerome Jerome!
November 11th, 2004 at 10:35 am
There is also JBehave, which is being developed by some thoughtworks fuckstains I know – http://www.jbehave.org/
TestNG uses annotations – that makes me sad.
November 11th, 2004 at 11:11 am
Wow! And I was just about to get around to finally using this JUnit thing.
Hani saved me in the nick of time!
November 11th, 2004 at 11:56 am
Anon: “Ward invented the wiki. Kent and Ward invented JUnit. Pretty successful ideas.”
Ward? From Cocobase? Kent? From Smallville?
Wiki is just a stupid name for a bulletin board system disguised as a blog.
JUnit is just a combination of Class.forName() with Runnable.run() .. how brilliant ..
Instead you should try TestGYN, which is my own personal wiki-based unit-testing software that I’m trying to build a consultancy around. Thanks!
November 11th, 2004 at 12:11 pm
Hey everyone we have a James Gosling hater here who seems to pretend he is James Gosling. Why don’t you go wack off you little winky in the corner and stop telling us about your dream of being raped in a cage by Johnathan Shwartz. Another thing – Go Fuck Yourself and that litle whore of yours you call your mother.
November 11th, 2004 at 12:47 pm
Hey everyone we have a Dude who doesn’t seem to get it.
November 11th, 2004 at 1:48 pm
I get it. Don’t you worry about that. There is just no need to impersonate yourself as James Gosling and confuse other people.
November 11th, 2004 at 3:02 pm
The only thing Cocobase Ward ever invented was the idea that you can sue Gavin King for inventing something better than Cocobase. But it’s true that Clark Kent invented the Wiki.
November 11th, 2004 at 3:04 pm
Dude, last year is over, we don’t talk about “impersonation” anymore.
November 11th, 2004 at 3:04 pm
about frickin’ time JUnit got biled…what a joke. it’ll test the fsck out of your awesome StringUtil class, but other than that it’s obviously naff.
November 11th, 2004 at 9:20 pm
real programmers don’t write tests. Period.
Don’t be a wimp, raise your head and face the act of development without a crutch.
November 11th, 2004 at 9:27 pm
may I remind you that “impersonation” and “impersonate” are trademarks of the JBozo Group Inc. – The joke^H^H^H^H server for the new age
If you insist on using those words our impersonated lawyer will prosecute you.
November 12th, 2004 at 12:13 am
Leave your ammo for Mr.Bush.
November 12th, 2004 at 8:09 am
Fucknuts the lot of ya … I KNOW my code works so why do I have to write tests to show everyone else ?
Just make sure you bow you heads reverentially as I walk past you serfs
November 12th, 2004 at 8:24 am
IMO, the only time unit testing works is when someone else writes the tests.
So why is it that us developers are forced to write unit tests for ourselves? Wouldn’t that defeat the purpose, by using one block of flawed code to test another block of similarly flawed code?
November 12th, 2004 at 3:31 pm
I agree, SUPPORT INDIVIDUALS ON THE JCP. We need more balance with the corporations. VOTE HANI!
November 12th, 2004 at 4:50 pm
It really is James…
November 13th, 2004 at 2:57 pm
First post on the JBoss vs Geronimo bile!
November 14th, 2004 at 7:12 am
If the BILE is BROWN,
then you should punch a CLOWN
November 14th, 2004 at 7:14 am
JSR 69
Java Porn API
November 15th, 2004 at 9:02 pm
Thanks Hani, for such a wonderful article. I am going to donate my testing tool to commons project. You just watch, it will be elevated above JUnit in a short few weeks. I’ve had great successes using my personal commons-unit with my JBoss EJB 4.0 projects with JSF and integrating with Maven and Drools is a snatch. You can even configure it in XML or Ruby scripts and it’s great with dot NET. :) BTW, my daddy is also a leading cult expert. http://www.rickross.com
November 22nd, 2004 at 10:52 am
LOL, seems like Hani lost big-time to the G-Mail wankers and JBoss turdarians. Sorry, Hani, but why did you run for the election anyway? It seems like the only reason was to offer the Flurries a chance to look down on you for a change…
Man, I’m dissappointed of you! Hope you at least had some “Oral” action with the gentleman who finished last.
November 22nd, 2004 at 4:46 pm
What was that about “niggers” and Junit?
Given that members of a national football team (soccer) Englandr were racially abuse last Wednesday
I am surprised by your comments. I though software
professional were above and aloof cultural hoo haas and demonstrated a better way to live
your life on planet, Earth. I think some
dont give a fuck whatever happens to progress
so it will be the same as it ever was…
The nuclear boob will prabably kill off all
of us in the end, sunce as a human
race were all fucked up.
Well listen up to tjhis:
Fuck you too, Hani you little bitch-ass cunt
November 26th, 2004 at 5:06 pm
“A Proud Black Man”
A.k.a. Peter Pilgrim.
November 26th, 2004 at 7:51 pm
Unit testing facilitates re-factoring you dumb ass. Junit or not, writing tests for every method is a must.
November 29th, 2004 at 11:25 am
On my way home from my paid software development job, every evening I pass a group of youths squatting on the cobbles in a circle next to the local mall. They sit there, dressed in their genuine imitation leather long black coats, jacked-up boots with big silver buckles, long, lanky black hair and heavy eye-makeup and bitch about everyone that walks past. “Look at that guy in the suit – he’s such a wage slave”. “Look at the good little housewife getting dinner for her husband”. “God, the cool kids at school are such losers”. “I’m glad I’m not a conformist like everyone else, I’ll never be a lemming” as they sit there in their identical clothes with their identical badges listening to identical goth music on their identical mp3 players and bum-puffing identical 1mg cigarettes with identical sneers absorbing their identical opinions from each other.
Fast forward a few years…
“God, those JUnit bible-thumpers are such losers, we’re so avant-garde in our disdain…”
I hope this site is clever satire. I really do.
December 8th, 2004 at 4:29 am
yes, james gosling would say the word ‘fuck’ and yes, he is an asshole. believe me, i know
December 8th, 2004 at 4:33 am
oh, and btw-he hates being called jimmy
December 8th, 2004 at 4:53 am
James is not an asshole. I spoke too soon. I apologize.
December 10th, 2004 at 1:13 am
Before Junit, a company called parasoft.com used to call us every friggin day. They wanted to sell unit test frameworks. At least junit is free.
January 22nd, 2005 at 5:58 pm
[Trackback] The Bileblog has a few words to say about blind adherence to the principles of testing with JUnit.
It’s fairly impressive how unit testing seems to have grabbed a number of java developers by the balls, and made them sing in surprisingly high voic…
June 14th, 2005 at 8:03 pm
To “Dude”-whoever you are, I’m not into writing code, so I don’t usually visit these sorts of message boards, and if it’s an inside joke I would not understand it, but you don’t know Mrs. Gosling, and you have no right to call her a “whore”, because she is a perfectly respectable lady. If you feel it’s ok to just randomly insult other people’s mothers (or paternal grandmothers) there is something seriously wrong with you. While you may be annoyed some other Birkenstock and t-shirt wearing nerd, leave his mother alone!
September 28th, 2005 at 4:48 am
It should be renamed to gay-unit…
September 30th, 2005 at 9:08 pm
Shut the fuck up u cunt fucking breeding mother fucking “straight” bastard go rape a dyke normal you piece of fucking worthless shit. Fucking faggot!!!!!!!!!!!!
October 10th, 2005 at 1:39 am
what’s up with nerds and profanity? learn something more interesting. try to elevate your vocabulary above the level of using a form of ‘f-ck’ to describe everything-or is that too f-ing hard?
November 8th, 2005 at 7:26 am
Hi,
well that was a bit of a rant. My take on Junit is that it is somewhere between very useful and essential. Let me skip the obvious bit about unit testing and so on. I found in my work another use of Junit, but a rather indirect use. Essentially it boiled down to this: If I write code which is functional and at the same time ECONOMICALLY testable in JUnit then generally I have found the code under test to be well structured. Conversely, code which is hard to drive via JUnit has tended to need some re-engineering. If you like, putting a JUnit view on the code lets me see faults in structure (or more typically in functionality and encapsulation). I put this down to the constraint of the code needing to run in two environments (the JUnit and production environments). Code which I recently re-engineered to be easily movable between JUnit and the production system was much cleaner and better structured than previously.
So, turning this all around. Let’s use Junit also as a tool to look at the structuring of our software. If the cost of JUnitting a piece of code appears high then perhaps the code needs a rewrite. Pair-wise development should make this easier as the correctiosn can be made on the fly.
Just to avoid the explosion which might result from this, let me say that I believe that there are code constructions which are exceptions and which are inherently difficult to Junit, but let’s regard these as exceptions, and start to apply the “Economical Junit” test as a measure of quality.
January 20th, 2006 at 4:10 am
when a beginner code a simple code,code one,pass one,then code another,pass another,you insure your code is passed by yourself,so others can use your interface,so whole team’s code can pass.
I can not imagining,Tom write 10 Class , include 100 method, everyone all not test, Jack also, in finally,Whole team could depend one Junit to test ,maybe 100 Class,1000 method, even more.
I come from china, hello friends.