Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Hello world
Testautomation
När, var, hur?
Jörgen Damberg, Claremont, SAST Örebro 2014-06-03
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
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
verkliga
[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
Test automation
• 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
Testning
Testing Checking/
verification Validation
Test automation
Mini course in automated testing
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
Continuous quality control
Risk reduction
Time
Ris
k
Automated testing – When? Support programmers Critique product
Business facing
Technology facing
Automated
Automated
Manual
Automated/Manual
Functional AT
Unit tests Edge cases Fast ~80% of the tests
Showcasing Exploratory
Performance tests Security tests
Varje nivå har sina pros&cons Pros Cons
UT Robust Cope with change Quick Thorough
Doesn’t test that the system works Easily simplified
IT Quite quick Could get thorough Easy to implement negative testing Robust
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
Testtyper
Tester som säkrar utvecklingsteamets
heder inför beställaren (kod, DB-
struktur osv)
Tester som säkrar IT-organisationens heder
inför verksamheten (MW-konfiguration,
produktionsplanering osv)
• Sprinttester
• Enhetstester
• Scenariobaserade flödestester
• Smoke tests
Körs ofta Kodnära Whitebox.
Körs mindre ofta Förtroendeskapande Blackbox
Mycket kod Mycket
underhåll
Komplexa gränssnitt
Komplex interaktion
Mycket ledtid
Stor kostnad
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?
Test automation
• Tråkiga tester • Datadrivna tester • Smoke tests (vertikal integration) • Vital, men perifer, funktionalitet
(affärsregler) • Tidödande tester • Testförberedelser
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), W3C-checkers, 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
Test 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
Deploy process TDD
ATDD
BDD
UT
ST SIT
CI/CD
Introduction
Test data management
Environments Choosing the right tool
Challenges
Alternatives
Success factors
Pitfalls
Specification-by-example
MBT
Appropriateness and ROI
PageObject Model
Pairwice testing
History
Tips and trix
Etc
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
Further reading?