Thursday, September 18, 2008

TotT: Mockin Ur Objectz

[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!

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!

Remember to download this episode of Testing on the Toilet and post it in your office.

7 comments:

  1. I must be lame, but I love it. :P Just wanted to say before the serious folks show up.

    ReplyDelete
  2. This post was totally unnecessary and not funny...

    ReplyDelete
  3. This post is totally funny and made my day! Thank you (Dave)!

    ReplyDelete
  4. Be careful if using Java - .equals() and .hashCode() on URLs access the internets.

    ReplyDelete
  5. @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!

    ReplyDelete
  6. A testing tip in lolcode... awesome! This totally made my day.

    ReplyDelete

The comments you read and contribute here belong only to the person who posted them. We reserve the right to remove off-topic comments.