Speakingofthecode, mutationtestingcanalsohelpinsurethatourcodeismeaningful, bywhich I meanthatanytinylittlechangetoithave a noticeableeffectonitsbehavior.
Supposewehave a functionlikethisSendmessageusessendbitestosend a CZManybitesusandbitescanhandleoverandoverpickingupwhereitleftofflasttimeuntilthemessagesallsent a fairlycommonpattern.
Now, a mutationtestingtoolcouldmakelotsandlotsofmutantsoutofthis, buttheone I wanttoshowyouisthis.
It's anexampleofremoving a loopcontrolbydeletingthosetwolineswithminussignsthere.
Andthatisthatif a mutantthatonlygoesthroughthisloopbodyoncemakeshasthesameresultastheoriginalcodedoesinthetests, andourtestsareonlymakingthecodegothroughtheloopbodyonce.
Sowhatdoesthatmean?
Itmeansthatwe'reonlytesting, sending a messagesmallenoughthatsendbitescanhandleitinonechunk.
Themostlikelycauseofthat, inturn, isthatwe'rejustnotsending a bigenoughmessagetomakeitgothroughBody 20 ormore, suchasinthiscase, wemighthave a maximumchunksize.
Whatsendbitescanhandleinoneshotof 10 foulsinvites, yetwereonlytestingwith a tinylittlethreebitemessage, andthey'rethefixisprettyclear.
Wecanjustinstruct a largermessage.
Takethesize, addone.
Makethatbig a messageon.
Therewego.
Butmaybeit's notthisparticularcause.
Maybewedidbestwiththelargestpermissiblemessageoutof a predefinedsetofmessages, oratleastmessagesizes.
Forinstance.
Herewehavesmallandlargesizes, andwedidtestwith a largeandyetthemutantsurvives.
Rightnow, I stillthinkit's just a reallycoolideain a geekykindofway.
Ifyou'd liketotry a mutationtestingforyourself, here's a listofone's forpopularlanguagesandplatformsandsomeotherones I doubtmanyofyouaredoingfortrained 77 thesedays.
AsforJavascript.
Theonlyone I knowofisStriker.
Thereusedtobeonethatwas a pluginforthegrunttaskrunner, butthatprojecthasfoldedinitscodehasbeenmigratedintostriker, buthestillneedssometimetotakepictures.
I sawsomecamerasupthere.
Okay, lastly, a coupleshoutouts.
1st 2 TopTowel.
A consultingnetwork I'm inwhosespeakersnetworkhelpedmeprepareinpracticethispresentation.
Theseusethatreferrallink.
Ifyouwanttheiris, sir, joinus.
Andsecondly, toMarcusSharp, creatorofMutant, a mutationdustingtoolforRubyMain.
When I'veactuallyused, he's beenverywillingtoanswermyignorantquestionstherebeingnosuchthingasstupid.