Hello world
Jörgen Damberg, Claremont, SAST Örebro 2014-06-03 Testautomation När, var, hur?
Vad vill ni prata/höra om?
10 CLS 20 Print Testing, boring routine work? 30 REM Short 40 PRINT Test automation introduction 50 PRINT Test automation concepts 60 PRINT Do/Dont 70 PRINT Tools 80 INPUT$ 90 GOTO Mingle 100 SLEEP 60*60 110 GOTO Home
verkliga Testningens uppgift Tänka på allt som ingen annan tänkt på Finna ut var olika människor förstått eller tolkat samma sak olika Upptäcka alla förutsättningar som ingen annan upptäckt Specialfall i data eller användning Användningsområden Tidsberoenden Tekniska beroenden osv Påtala glömda aktiviteter Hitta var någon råkat gjort fel
[au-tu-ma-ti sé-ra ]
Current trends beneficial for test automation TDD/BDD Shorter iterations Focus on business value Focus on working code Refactoring Centraliced architektures quick change cycle Dynamic teams Insights in maintenance costs A lot of reuse of old code in new ways More use of standard components Better automation tools Cheaper automation tools Parallell development and maintenance More mature testing insights in many organizations Test automation
Current trends making test automation more cumbersome Shorter life cycles for development technologies More frequent changes to systems The W model is flattened Products under test getting more and more complex Maaaaany devices Test automation
Testning Testing Checking/ verification Validation
Mini course in automated testing Test automation
Why automate the testing? Faster execution => quicker/more frequent feedback More exact checks very repetetive Not being dependent on specific persons with specific competences, and getting rid of the lead times from that dependency Re-use of effort Quality metrics More combinations tested Freeing time for manual testing where the humans excel
Risk Continuous quality control Risk reduction Time
Automated testing When? Support programmers Critique product Functional AT Showcasing Exploratory Business facing Automated Manual Technology facing Unit tests Edge cases Fast ~80% of the tests Automated Automated/ Manual Performance tests Security tests
UT IT Varje Pros nivå har sina Cons pros&cons Robust Cope with change Quick Thorough Quite quick Could get thorough Easy to implement negative testing Robust Doesn t test that the system works Easily simplified More care to the environment Data management is an issue ST Test the whole system Make sure the business value remains Slow Many dependencies Hard to get good coverage SIT Quick (In the best of worlds) Slow (In the worst of worlds) Lots of dependencies Hard to get coverage Dependencies to things outside of team control
Automation type Business process coverage Code coverage Execution time GUI 70% 5% Hours API 25% 25% Minutes Unit testing 5% 70% Seconds
Körs ofta Kodnära Whitebox. Testtyper Tester som säkrar utvecklingsteamets heder inför beställaren (kod, DBstruktur osv) Sprinttester Enhetstester Körs mindre ofta Förtroendeskapande Blackbox Tester som säkrar ITorganisationens heder inför verksamheten (MW-konfiguration, produktionsplanering osv) Scenariobaserade flödestester Smoke tests
Stor kostnad Mycket ledtid Mycket kod Mycket underhåll Komplex interaktion Komplexa gränssnitt
Ett testautomatiseringsscript motsvarar den mest detaljerade testspec du någonsin tagit fram, och som alltid måste vara exakt uppdaterad för att funka. Förmodligen dessutom av specialister Ställer stora krav på testkodsarkitektur för att bli förvaltningsbart
Checking and verification against an oracle In order to have an oracle for at test case you ll need: Correct sequence of events, on the right object Appropriate environment (i.e. parameter configuration, integrations) Right versions of components Correct input data Right order of test executed Assumed meta-data in the system Assumed background data in the system Correct user rights for the user account and so forth
Verktygstyper - systemtest Verktygsvalet beror på val av approach och gränssnitt WS/API/MQ och andra systemgränssnitt ICC-verktyg Protokollnivå (headless browser) GUI-verktyg Bildigenkänning Objekthanterande
Vilka tester lämpar sig för automation? Tråkiga tester Datadrivna tester Smoke tests (vertikal integration) Vital, men perifer, funktionalitet (affärsregler) Tidödande tester Testförberedelser Test automation
Utmaningar med automatisering Lätt att råka tappa kontrollen över vad testfallen gör Det ÄR en mjukvarulösning med intima beroenden till en annan mjukvarulösning Kräver disciplin Kommunikationsglapp blir tydliga vid en automatisering Ta hand om någon annans bebis Scripten är i förvaltning från första körningen. Blir lätt nerprioriterat när det hettar till, och tappar då snabbt värde Ingen serendipitet
Fördelar med automatisering Fördelar med automatisering: Ökad förvaltningbarhet av systemet Snabbare incidenthantering Testtid över till mer högvärda tester Fler kombinationer testade, mer regelbundet Snabbare återkoppling Noggranna kontroller Slippa personberoende och ledtider Testa oftare
Skill set för testautomatiserare Kommunikation Struktur Kreativitet
Är det verkligen testexekveringen som man ägnar mest tid till?
Effektiv testning Koll på förutsättningarna för test Koll på utvecklarmaskiner, kodgrenar och byggen Automatisera det som gör mest nytta Informations-spårbarhet Kommunikation Testdatahantering Testfallsframställning (Pairwise testing) Testmiljöhantering Testexekvering
More things to automate Automation of combinatory testing: Pairwice Automation of test data management (subsetting, anonymization of data, syncing data between systems, configuration management) Automation of release management/deployment
Detta är verktygs-bilden (gratisverktyg) Pairwice: ACTS, Pict, Allpairs GUI-baserade systemtester: Sikuli Objekt-baserade systemtester: AutoIT, Selenium, Sahi, Watir/Watin BDD: Specflow/Cucumber API-baserade systemtester: SoapUI Webb-utilities: Link-crawlers (Xenu), W3Ccheckers, Firebug, Yslow, Chrome Dev.tools. Miljöhantering: PowerShell, AutoIT
Några olika testautomationskoncept Model based testing (MBT) Specification by example (SBE/BDD) Testapor Scenariobaserad end-2-end testing Automatiserade regressionstester Datadriven testning Keyword driven test automation
Alternativ till automation Hårt arbete Optimera utvecklingsprocessen Test on tap Acceptans av risk och teknisk skuld Acceptans av ledtider Redigt tillförlitliga rollback-rutiner
Frågor, sharing, synpunkter och kommentarer
PageObject Model Introduction MBT ATDD TDD BDD Success factors SIT ST History Pitfalls Alternatives Pairwice testing UT CI/CD Deploy process Specification-by-example Test data management Environments Challenges Tips and trix Etc Choosing the right tool Appropriateness and ROI
Further reading? Googleable stuff Page Object Model/Data Factories Keyword driven testing Stuff to try out Opensourcetesting.org HP/IBM/MicroFocus/MS web sites JAutomate, Project White, Specflow Attend a course
Tack! Jorgen.damberg@claremont.se @kejsardamberg