![Page 1: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/1.jpg)
HowILearnedtoStopWorrying&LovetheBug
Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz)
![Page 2: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/2.jpg)
¨ Cannotprovetherearenobugs¤ Canonlyshownobugsexistonthosetests
HowToWriteTests
Testingshowsthepresence,nottheabsence
ofbugs
![Page 3: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/3.jpg)
¨ 20%ofcodehas80%ofbugs¤ Modulesthataremostcomplex,intricate,ordetailed¤ Locationswhereexpectationsofdatamightdiffer¤ Codeintransition:frequentlychangedmodules¤ Anyplacewhereprogramrequiresuserinput
¨ Focustestingeffortstoconcentrateonthesebugs¤ Tests(&testing)expensive&simplertoolsforeasycode¤ Automationmatters;errorsoftenoccuratjoinpoints
WhatToTest&Why
![Page 4: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/4.jpg)
Assumetheworst:Focustestingon
unlikelysituations
TestsKeyConcept
![Page 5: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/5.jpg)
InputTests…
![Page 6: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/6.jpg)
…andFinally
![Page 7: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/7.jpg)
¨ Inrealworld,somecasesmaynotbeworthtesting¤ Mustassumebugsexistsoideallytesteverything¤ Savetime,donotchangeinputtochecksameidea¤ Simplegetters&setterseasy,butcheckbeforecommit¤ Focusonpossibilities,donotcheckimpossiblecases
WheretheBugsAren’t
![Page 8: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/8.jpg)
GoodTests
public class Stock { private double cost; //Constructor&gettersimple&skippedforspace
//Decreasescostofastock;deltaismax.dropincost //Returnsupdatedvalueofcost public double reduceCost(double delta) { }
//Evenmorecodewouldbehere,werethisnotanexampleforclass
public class StockTest { @Test public void t1() { Stock ibm = new Stock(141.31); assertEquals(141.31, ibm.reduceCost(0), 0.001); assertEquals(141.31, ibm.getCost(),0.001); }
![Page 9: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/9.jpg)
MoreGoodTests
public class StockTest { @Test public void t2() { Stock siri = new Stock(7.10); assertEquals(0.0, siri.reduceCost(8), 0.001); assertEquals(0.0, siri.getCost(),0.001); }
public class Stock { private double cost; //Constructor&gettersimple&skippedforspace
//Decreasescostofastock;deltaismax.dropincost //Returnsupdatedvalueofcost public double reduceCost(double delta) { }
//Evenmorecodewouldbehere,werethisnotanexampleforclass
![Page 10: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/10.jpg)
NotaGoodTest
public class StockTest { @Test public void t3() { Stock htz = new Stock(15.09); assertEquals(?????, htz.reduceCost(-100), 0.001); assertEquals(?????, htz.getCost(),0.001); }
public class Stock { private double cost; //Constructor&gettersimple&skippedforspace
//Decreasescostofastock;deltaismax.dropincost //Returnsupdatedvalueofcost public double reduceCost(double delta) { }
//Evenmorecodewouldbehere,werethisnotanexampleforclass
![Page 11: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/11.jpg)
NotaGoodTest
public class Stock { private double cost; //Constructor&gettersimple&skippedforspace
//Differencefromcostatwhichpeoplesoldstock;deltaismax.dropincost //Returnsupdatedvalueofcost public double reduceCost(double delta) { }
//Evenmorecodewouldbehere,werethisnotanexampleforclass
public class StockTest { @Test public void t3() { Stock htz = new Stock(15.09); assertEquals(?????, htz.reduceCost(-100), 0.001); assertEquals(?????, htz.getCost(),0.001); }
![Page 12: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/12.jpg)
TestsKeyConcept
Assumetheworst:Focustestingon
unlikely(butNOTimpossible)situations
![Page 13: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/13.jpg)
¨ Smallbugsinloopscancreatehugeerrors¤ Lotsoftimeexecutingincreasesoddsofhittingrarecase¤ Oftenerroronlyappearswhenresultsused,notinloop¤ Debuggingoftentricky,sincemanyscenariostotestout
¨ Runoften+hard-to-debug==criticaltotestwell¤ Findingbugsimportant,sincequalitydependsonthis¤ Knowingbugsexistsuseless;mustalsosimplifyfixes¤ Sonarrowingbug'scausejustasneededasfindingbug
LoopTestingImportant
![Page 14: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/14.jpg)
TypesofLoops
![Page 15: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/15.jpg)
¨ Forallsimpleloops,tryinputsthat:¤ Skiploopentirely¤ Make1passthroughtheloop¤ Make2passesthroughtheloop¤ Makempassesthroughtheloop,where(m>2)
¨ Ifloopexecutedatmostntimes,tryinputsthat:¤ Maken-1&npassesthroughtheloop
SimpleLoop
![Page 16: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/16.jpg)
¨ Firsttestsetrunsallouterloopsexactlyonce¤ Innerloopruns(min+1),average,(max-1)&maxtimes
¨ Thenrunallbuttwoinnermostloopsexactlyonce¤ Innerloopsrun(min+1),average,(max-1)&maxtimes
¨ Testsshouldcontinuegrowingloop-by-loop
NestedLoops
![Page 17: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/17.jpg)
TypesofLoops
![Page 18: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/18.jpg)
ConcatenatedLoops
¨ Ifloopsareentirelyindependent¤ Noconditions,variables,orvaluesincommon¤ Woo-hoo!Justperformsinglelooptestsoneach
¨ Otherwisetreatasnestedloops&makelifeeasier¤ Workasifthefirstloopistheoutermostloops
![Page 19: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/19.jpg)
UnstructuredLoops
¨ Figureouttheprocessleadingtothisdecision¤ Burnartifactsandcoderesultinginthisabomination
![Page 20: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/20.jpg)
UnstructuredLoops
¨ Figureouttheprocessleadingtothisdecision¤ Burnartifactsandcoderesultinginthisabomination¤ Anyoneinvolvedshouldterminatedimmediately
![Page 21: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/21.jpg)
UnstructuredLoops
¨ Figureouttheprocessleadingtothisdecision¤ Burnartifactsandcoderesultinginthisabomination¤ Anyoneinvolvedshouldterminatedimmediately
¨ ReWrite“missing”documents,startingfromscratch
![Page 22: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/22.jpg)
¨ Unittestsgoodforsometasksworkingonback-end¤ Butwhatabouttasksimplementingfront-endcode?¤ Userwantsresultsandonlyknowswhattheycansee¤ Correctresultsimpossibleifback-endfailsunittests
¨ Back-endcodeveryimportantsocannotskiptests¤ Butinvisibletouserandclientdoesnotcareaboutcode
Back-EndTesting
![Page 23: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/23.jpg)
¨ Needtotestfront-endtasksthatdisplayinformation¤ GUIclassescanbecheckedagainstuserstories¤ JUnittestcaseslessusefulperformingthesetests¤ Automationlackshumantouch;cannotcheckaesthetics
Front-EndTesting
![Page 24: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/24.jpg)
¨ Worstapproach:Clickingaround&seewhatbreaks¤ Simple&fast,butmaynotdiscoveractualcauseofbugs¤ Unrepeatable&slowwhencheckingentiresystem¤ Donebydevelopers,tendstofollowexpecteduses
Front-End"Testing"
![Page 25: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/25.jpg)
¨ Betterapproach:Step-by-stepscripttestsforerrors¤ Lowoverhead&simple,butalsoeasytoforgettorun¤ Discoverunexpectedbugsbyhavingtestersrunscripts¤ Goodrules-of-thumbexisttofindmanycommonerrors¤ ListintaskinZenHub;manywantfilestoholdscripts
Front-EndTesting
![Page 26: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/26.jpg)
¨ Betterapproach:Step-by-stepscripttestsforerrors¤ Lowoverhead&simple,butalsoeasytoforgettorun¤ Discoverunexpectedbugsbyhavingtestersrunscripts¤ Goodrules-of-thumbexisttofindmanycommonerrors¤ ListintaskinZenHub;manywantfilestoholdscripts
Front-EndTesting
![Page 27: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/27.jpg)
¨ Bestapproach:AutomatetestingwithUItool/code¤ Createssetupcosts,butguaranteespredictableresults¤ Cancompensateforloadtimes&otherrealissues¤ Oftenincludebothprogramming&scriptingsetups
ValidationTesting
![Page 28: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/28.jpg)
¨ Allowsautomatedtestingofweb-basedapplications¨ Testsuitereportsresultsofrunning1ormoretests¨ Oftencreatemanytestcases;eachexposes1bug
¨ AddtestsinJava/C#/PythonwithWebDrivermodule¤ ManylanguageshaveSeleniumlibrariestodrivetests¤ Loadspage&definesAPIusedtoevaluateitscontents
¨ IfusingIDE,abletocreate&runsinbrowser¤ IDEeasiertouse:canrecordactionsinbrowserastest¤ WillalsoallowupdatingorrewritingSelenesescript
Selenium
![Page 29: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/29.jpg)
¨ Easiestmoduletouse,butneedsChrome*towork¤ DownloadviaChromeWebStoretobereadytouse¤ Scriptsmostlyrecordedbyclickingonelementstotest
¨ Startprocessusingthecommandopentoloadpage¤ click[AndWait]"clicks"onitemthatyouidentify¤ Scriptcanalsoentertextintoelementusingtype
¨ LikexUnittests,reliesonassertionstodefinechecks¤ assertTitlecheckstitleofpage(textshownontab)¤ CheckiftextonpageusingverifyTextPresent ¤ verifyElementPresentchecksifelementonpage
SeleniumIDE
![Page 30: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/30.jpg)
public static void main(String[] args) { WebDriver driver = new EdgeDriver(); driver.get("http://www.google.com"); WebElement el = driver.findElement(By.name("q")); element.sendKeys("Hawaiian-Print Computer"); element.submit(); WebDriverWait stall = new WebDriverWait(driver, 10); boolean result = stall.until(
new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().startsWith("Hawaiian"); }}); System.out.println("Met expectations: " + result); driver.quit(); }
SeleniumWebDriver+Java
![Page 31: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/31.jpg)
driver = webdriver.Firefox() driver.get("https://cse.buffalo.edu/~mhertz") assert "Matthew Hertz" == driver.title crselnk = driver.find_element_by_xpath( "/html/body/table[2]/tbody/tr/td[1]/p/a") crselnk.click() result = WebDriverWait(driver, 10).until( lambda x : "CSE442" in x.title) assert result
SeleniumWebDriver+Python
![Page 32: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/32.jpg)
¨ Inputoverflows:Typestringlongerthannormal/fits¤ Checkthattextisaccepted(orprovidesGOODerror)¤ Iftextisaccepted,areresultsreadableorusable?¤ Specifytext(trymanysizes)inscriptscheckingthis
CommonFront-EndErrors(1)
![Page 33: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/33.jpg)
¨ Structureoverflow:Makepanelslargerthanpage¤ Doesthiscreateerrorsorissystemabletohandledata¤ Doitemsresize,scroll,orprovidewaytoseeeverything?¤ Similartolooptests;detailinginputstousecritical
CommonFront-EndErrors(2)
![Page 34: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/34.jpg)
¨ ViolateAssumptions:Assumeusersjerks(ordumb)
CommonFront-EndErrors(3)
![Page 35: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/35.jpg)
¨ ViolateAssumptions:Assumeusersjerks(ordumb)¤ Theywillmakeworstchoice.Howdoessystemreact?¤ Whatifneededfilesdeleted,networklost,orsimilar?¤ Scriptexplainhowtostart&whaterrorshouldbeshown
CommonFront-EndErrors(3)
![Page 36: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/36.jpg)
¨ DuplicationIssues:Repeatedlyentersameinput¤ IfWhentheyadd/removemultipletimes,whatiserror?¤ Doesapphandle(orprovideclues)forimpatientusers?
CommonFront-EndErrors(4)
![Page 37: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/37.jpg)
¨ DuplicationIssues:Repeatedlyentersameinput¤ IfWhentheyadd/removemultipletimes,whatiserror?¤ Doesapphandle(orprovideclues)forimpatientusers?¤ “Back”buttontempting,whatdoesitdotowebapp?
CommonFront-EndErrors(4)
![Page 38: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/38.jpg)
¨ InvalidData:Intentionallyforceinvalidresults¤ Scriptactionscreatingillegalstateinwidgetattheend¤ Feb29remaininnon-leapyears?Movestartafterend?¤ Giveintothedarkside&tricksystemintobadstates
CommonFront-EndErrors(5)
![Page 39: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/39.jpg)
¨ Resizingissues:Canithandledifferentwindowsizes¤ Scriptresizingwindow&makesureprogramstillusable¤ Setmonitortosmallerscreen&seeiflayoutworks¤ Tryforcingscrollbaruse&seehowuserswillreact
CommonFront-EndErrors(6)
![Page 40: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/40.jpg)
¨ JavaScriptisahorrible,horriblelanguage
Non-UIJavaScriptTesting
![Page 41: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/41.jpg)
¨ JavaScriptisahorrible,horriblelanguage¤ BrendanEichcreated&implementedJSin10days¤ Namewasbuzzword;neverrelatedtoJava¤ Notintendedasstandard;NetscapelookingtobeatIE¤ "Standards"exist,butimplementationsvarygreatly
¨ Languagecombinesmanyfeaturestoprovideitall¤ OO,functional,ordeclarativecodesupportexists¤ JSoftenimplementsmiddle-tier&front-endlayers¤ Testdifferentlevelsseparatelywouldbeideal,buthow?
Non-UIJavaScriptTesting
![Page 42: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/42.jpg)
¨ RealweaknessofJSisdifficultyintestingcode¤ Notgreatlyused,butMochabestunittestinglibrary¤ Middle-tiertestedviafront-endinmany/mostsituations¤ Nothelpfultounderstand&fix,butshouldfindbugs
¨ GoodlanguagecompilingtoJSisalternateapproach¤ Oncecomplete,usetestsandtoolsfororiginallanguage¤ ScalaJS,TypeScript,&Dartdevelopedforthispurpose¤ Allofthisalsoassumesthatbugnotcreatedbycompiler
Non-UIJavaScriptTesting
![Page 43: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/43.jpg)
Utility:Isituseable
OtherTestingIssues
![Page 44: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/44.jpg)
Utility:IsituseableReliability:Willyouendupleadstoryonnightlynews?
OtherTestingIssues
![Page 45: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/45.jpg)
Utility:IsituseableReliability:Willyouendupleadstoryonnightlynews?Robustness:Howlongofdisclaimerwillitneed?
OtherTestingIssues
![Page 46: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/46.jpg)
Utility:IsituseableReliability:Willyouendupleadstoryonnightlynews?Robustness:Howlongofdisclaimerwillitneed?Performance:WillitfinishbeforeBuffalowinsatitle?
OtherTestingIssues
![Page 47: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/47.jpg)
KeyPoint
=
![Page 48: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/48.jpg)
¨ "Acceptancetests"checkuserstorycomplete¤ Ensuresfeatureworksandreadyfordeployment¤ Runbyclientsohavetobescriptedtests¤ Ensurefullunderstandingofallaspectsoffeature
¨ "Tasktests"checkthatataskiscomplete¤ Ensurestaskcompleteandreadyforinclusion¤ Runbydeveloperssocanbescriptedtestsorunittests¤ Findsbugsduringcoding&throughlaterchanges¤ Alsodefineswhatsuccessliketoenableparallelwork
Terminology
![Page 49: Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew ... · How I Learned to Stop Worrying & Love the Bug Picture Courtesy of: Dr. Sarah Ford (a.k.a. Mrs. Matthew Hertz) ¨ Cannot](https://reader036.vdocuments.us/reader036/viewer/2022090605/6059c33fd48e7a4df96951b2/html5/thumbnails/49.jpg)
¨ WorkonSprint1¤ Rememberthetests!Testsvalidateyourunderstanding
ForNextLecture