TotT: Mockin Ur Objectz
Thursday, September 18, 2008
[A light hearted episode this week... but still with a serious message. Enjoy. -Dave]
HALP! Mah unit tests be doin' too much I/O! Testin' this lil' codes uses MOAR RESOURCES!
Oh NOES! Usin' internets in ur unit testz? Don't clog the tubes! Is not big truck! Mock the LOLIO thingy. No moar tubes!
Now ur test runs fast! You can use mock_lol_io for killin' nondeterminism, too like for exceptions n stuff. Is fun, makes ur code execute pathz it nevar seen b4. Wit dis, you can see wut happens when theres a OH NOES like the tubez bein clogged.
Now U know the sekrit for faster tests. Shh, don't tell Microsawft or the Yahew. They might be in our base, stealin our tech!
KTHXBYE!
HALP! Mah unit tests be doin' too much I/O! Testin' this lil' codes uses MOAR RESOURCES!
GIMME lol_io LIKE LOLIO
SO IM LIKE PROCESSIN WIT DATAZ OK?
GIMME EACH BUCKET IN UR DATAZ OK?
BUCKET OWN FUBARRED?
N CAN HAS NONE
NOPE?
N CAN HAS 1
KTHXBYE N
IZ __name__ KINDA LIKE “__main__”?
UR PROCESSIN WIT LOLIO OWN GET_SOME_DATAZ
BTW, GET_SOME_DATAZ USES UR INTERNETS LOL
Oh NOES! Usin' internets in ur unit testz? Don't clog the tubes! Is not big truck! Mock the LOLIO thingy. No moar tubes!
GIMME mock_lol_io LIKE LOLIO
BTW, GIMME THING TO TEST
BTW, TEST THE THING NOW KTHX
Now ur test runs fast! You can use mock_lol_io for killin' nondeterminism, too like for exceptions n stuff. Is fun, makes ur code execute pathz it nevar seen b4. Wit dis, you can see wut happens when theres a OH NOES like the tubez bein clogged.
BTW, SOMETIMES THEY BE CALLIN DIS DEPENDENCY INJECTION ROFL
BTW, YOU CAN UZE MOCKZ N STUF FER DIS LOOK:
IN MAI library GIMME mock_filesystem LIKE LOL_FAKE_FILEYSTEM
BTW, NOW U CAN USE LOL_FAKE_FILESYSTEM TO MAKE FAKE FILEZ IN MEMORY N STUFF
BTW, IS FASTER THAN OPENIN FILEZ ON TEST SERVAR
Now U know the sekrit for faster tests. Shh, don't tell Microsawft or the Yahew. They might be in our base, stealin our tech!
KTHXBYE!
I must be lame, but I love it. :P Just wanted to say before the serious folks show up.
ReplyDeleteIsn't it "BUKKIT" in LOLCODE?
ReplyDeleteThis post was totally unnecessary and not funny...
ReplyDeleteThis post is totally funny and made my day! Thank you (Dave)!
ReplyDeleteBe careful if using Java - .equals() and .hashCode() on URLs access the internets.
ReplyDelete@samu: Hell yes it was funny, maybe if you haven't heard about LOLCODE the joke is not as good, but this post was totally made of win!
ReplyDeleteA testing tip in lolcode... awesome! This totally made my day.
ReplyDelete