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
N CAN HAS 1
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!
Remember to download this episode of Testing on the Toilet and post it in your office.
Link - from Google Testing Blog
Related: The Google Maps API Open Source Their Selenium Test Suite
Presubmit And Performance