TG Half-day Tutorials 5/6/2014 8:30:00 AM Test Automation Patterns: Issues and Solutions Presented by: Seretta Gamba Dorothy Graham Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 888-268-8770 ∙ 904-278-0524 ∙ [email protected]∙ www.sqe.com
Automating system level test execution can result in many problems. It is surprising to find that many people encounter the same problems, yet they are not aware of common solutions that have worked well for others. These problem/solution pairs are called “patterns.” Seretta Gamba recognized the commonality of these test automation issues and their solutions and, together with Dorothy Graham, has organized them into Test Automation Patterns. Although unit test patterns are well known, Seretta and Dorothy’s patterns address more general issues. They cover management, process, design, and execution patterns to help you recognize common test automation issues and show you how to identify appropriate patterns to solve the problems. Issues such as No Previous Automation, High ROI Expectations, and High Test Maintenance Cost are addressed by patterns such as Maintainable Testware, Tool Independence, and Management Support. Laptop required (with USB access). An offline version of the wiki will be available to copy to your laptop from a USB stick to use during the session.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
TG Half-day Tutorials
5/6/2014 8:30:00 AM
Test Automation Patterns:
Issues and Solutions
Presented by:
Seretta Gamba
Dorothy Graham
Brought to you by:
340 Corporate Way, Suite 300, Orange Park, FL 32073
Seretta Gamba has more than thirty years of experience in software development. As test manager at Steria Mummert ISS GmbH, Seretta was charged with improving the test automation process. After studying the current strategies, she developed a style of keyword-driven testing and a framework to support it. In 2009, the framework was extended to support manual testing. Speaking about this at EuroSTAR, Seretta got the attention of Dorothy Graham who subsequently invited her to contribute a chapter to Dot’s bookExperiences of Test Automation. After reading the entire book, Seretta noticed recurring patterns in solving automation problems and is currently intent on cataloguing test automation patterns.
Dorothy Graham Independent Test Consultant
In software testing for forty years, Dorothy Graham is coauthor of four books—Software Inspection, Software Test Automation, Foundations of Software Testing and Experiences of Test Automation—and is currently working with Seretta Gamba on a new book on test automation patterns. A popular and entertaining speaker at conferences and seminars worldwide, Dot has attended STAR conferences since the first one in 1992. She was a founding member of the ISEB Software Testing Board and a member of the working party that developed the ISTQB Foundation Syllabus. Dot was awarded the European Excellence Award in Software Testing in 1999 and the first ISTQB Excellence Award in 2012. Learn more about Dot at DorothyGraham.co.uk.
Tutorial description • Testers often encounter problems when automating system
level test execution. These problems often have known solutions, yet many testers are not aware of them.
• Recognizing the commonality of these test automation issues and their solutions, Seretta Gamba and Dorothy Graham have organized them into a set of Test Automation Patterns.
• A pattern is a general, reusable solution to a commonly occurring problem, commonly used in development.
• Issues include NO PREVIOUS AUTOMATION, HIGH ROI EXPECTATIONS, HIGH TEST MAINTENANCE COST
• Patterns include MAINTAINABLE TESTWARE, TOOL INDEPENDENCE, MANAGEMENT SUPPORT
Tutorial objectives • help you recognize test automation issues
– share information with others having similar problems – look in detail at a couple of selected common issues
• explore ways of solving automation issues using patterns – look at alternative solutions, depending on context – ways to implement selected patterns
• work on your own issues* – identify your most pressing issues – investigate patterns that may help address them
• NOTE: system level automation, not unit level • NOTE: test automation patterns, not test patterns
*using [offline] Test Automation Patterns wiki on your laptop
4
Issues (problems)
• what problems affect you in test automation? – what causes the most trouble? – what takes longer than it should? – what is holding you back in your automation? – what are you struggling with? – what would you most like to improve?
Practical work • form groups of people with similar problems:
– not done automation before – want to improve/revive automation, but suffer from:
• lack of support • lack of resources • lack of direction • lack of specific knowledge • expectations for automation not met • unsatisfactory quality of automation
• fill out page 1 of your worksheet – introduce yourselves in your group
Issue: HIGH MAINTENANCE COST • Maintenance of the test automation scripts
takes a long time and costs more than it’s worth
• Questions: – what cost (or time) would be acceptable? – how is the cost measured? – Note: answers may be different in different
contexts
18
Issue: HIGH MAINTENANCE COST 1 • What are your symptoms?
– When software changes, e.g. window sequence is different, tests fail. More effort to edit the existing tests than to start again. (Capture/replay used)
– Are the scripts structured and reusable? • 1) No, scripts are mainly “stand-alone” without much
reuse, automators are “re-inventing” • 2) Yes, structured and reusable scripts, but it needs
automators to add new tests, and we are short of time and/or automators
FILE ADD MOVE DELETE Europe France Germany 1,3 2,2 1 5,3
Data-driven example
Data file: TestCase1
FILE ADD MOVE DELETE countries Sweden USA 4,1 Norway 2 7
For each TESTCASE OpenDataFile(TESTCASEn) ReadDataFile(RECORD) For each record ReadDataFile(RECORD) Case (Column(RECORD)) FILE: OpenFile(INPUTFILE) ADD: AddItem(ITEM) MOVE: MoveItem(FROM, TO) DELETE: DeleteItem(ITEM) ….. Next record Next TESTCASE Control script
26
Comparison of data- and keyword-driven
ScribbleOpen Europe AddToList France Italy MoveItem 1 to 3 MoveItem 2 to 2 DeleteItem 1 MoveItem 5 to 2 SaveAs Test2
keyword approach data-driven approach
FILE ADD MOVE DELETE SAVE Europe France Italy 1,3 2,2 1 5,2 Test2
which is easier to read/understand?
what happens when the test becomes large and complex?
• Just go on as always • Search on the internet for a cure • Pay a consultant • Become a test automation guru • Come to this conference to the automation doctor
How satisfied are you with your current automation?
38
Issue description: NO PREVIOUS TEST AUTOMATION
You are supposed to start automating tests, but neither you nor your team has any experience in test automation and it hasn’t ever been implemented in the company, or it was tried earlier and failed so you need to start again
• You have never successfully got going with test automation.
• You have tried in the past with test automation but it was abandoned.
• You are wanting to automate in a way that you haven't done before (e.g. GUI level system testing if you have automated unit tests already).
Patterns: 1. SET CLEAR GOALS 2. MANAGEMENT SUPPORT 3. DEDICATED RESOURCES 4. RIGHT TOOLS 5. AUTOMATION ROLES 6. PLAN SUPPORT ACTIVITIES 7. MAINTAINABLE TESTWARE 8. AUTOMATE WHAT’S NEEDED 9. TAKE SMALL STEPS 10. UNATTENDED TEST EXECUTION
40
Pattern: SET CLEAR GOALS
Define the automation objectives from the very beginning in a way that is clear and understandable to all.
Context This pattern is always applicable, although the goals may be different at different stages. • when you first consider test automation • when an automation initiative is getting started • when your automation is going well • when you want to revitalise a stalled automation effort.
If you don‘t know what your goals are, how do you know that you are going in the right direction?
Description • automation objectives defined clearly up front no disappointment later.
• Inform your managers about what is feasible and what is not.
Goals should be measurable so that you can tell if you have achieved them or not.
42
Pattern: SET CLEAR GOALS
Implementation examples • Selected regression tests should run x-times faster and y-times more often. • Tests too complex to perform manually are to be automated. Define exactly which ones. • …..
Not good goals • confuse the goals for automation with goals for testing. • Automate all manual tests
The test automation team is available full time and all the needed tools and machines are in place
Context Not applicable for very small organizations with only one or two testers.
Description • A test automation team is assigned to work on test automation full-time, without other responsibilities. • Any, tools, utilities, machines or other resources are provided as needed. • You can get the help of specialists when you need it.
50
Pattern: DEDICATED RESOURCES
Implementation • Test automation should be done as a FULL TIME JOB • PLAN SUPPORT ACTIVITIES • Tools and machines to run the tests need to be available, and ideally dedicated to running automated tests. GET ON THE CLOUD for cost-efficiency. • SHARE INFORMATION
Potential problems It is often the case that resources are severely limited, but expecting people to "do test automation in their spare time" is very unlikely to work, and is not efficient.
52
Example 3: Second question (Q1.2)
What describes the most pressing problem you have to tackle at the moment?
– Steria-Mummert-ISS, Hamburg / Germany – Standard Software for insurances
• my background – developer – test manager
• 2001, wanted to start automation – NO PREVIOUS AUTOMATION
• this is the issue we had then
62
NO PREVIOUS TEST AUTOMATION • resolving patterns:
1. SET CLEAR GOALS 2. MANAGEMENT SUPPORT 3. DEDICATED RESOURCES 4. RIGHT TOOLS 5. AUTOMATION ROLES 6. PLAN SUPPORT ACTIVITIES 7. MAINTAINABLE TESTWARE 8. AUTOMATE WHAT’S NEEDED 9. TAKE SMALL STEPS 10. UNATTENDED TEST EXECUTION
automate regression tests for the
registration product
We chose an older tool that could drive our application reliably
I knew how to write good code for the automation
Done
Done
Done SET CLEAR GOALS RIGHT TOOLS MAINTAINABLE TESTWARE AUTOMATE WHAT’S NEEDED TAKE SMALL STEPS UNATTENDED TEST EXECUTION
– we had a good architecture and framework – easy to add new automated tests – company-wide automation standards – automated everything we had planned – expected our ratio of automated to manual tests to
What happened next: Stagnation • marketing success = automation problem
– increase in business, new features – developers and testers needed on business-
critical tasks, taken off automation – leading to new issues:
• INADEQUATE SUPPORT • INADEQUATE COMMUNICATION • NO INFO ON CHANGES
– no time for automation, which would have given them more time!
68
NO PREVIOUS TEST AUTOMATION • resolving patterns used/missed:
1. SET CLEAR GOALS 2. MANAGEMENT SUPPORT 3. DEDICATED RESOURCES 4. RIGHT TOOLS 5. AUTOMATION ROLES 6. PLAN SUPPORT ACTIVITIES 7. MAINTAINABLE TESTWARE 8. AUTOMATE WHAT’S NEEDED 9. TAKE SMALL STEPS 10. UNATTENDED TEST EXECUTION
I was doing the automation in my
“spare time”
I was automator, tester, developer and project leader
at first I didn’t need support, didn’t think about this
MANAGEMENT SUPPORT - 1 • Implementation Build a convincing TEST AUTOMATION BUSINESS CASE.
Test automation can be quite expensive and requires, especially at the beginning, a lot of effort.
Without a business case there is no real commitment from management to continue to support test automation, e.g. when development projects need the same resources. Just as for testing in general, test automation doesn’t come first! Management initiation of the automation was good, but it wasn’t enough – needs ongoing support .
70
MANAGEMENT SUPPORT - 2 A good way to convince management is to DO A PILOT. In this way they can actually “touch” the advantages of test automation and it will be much easier to win them over.
• SET CLEAR GOALS • RIGHT TOOLS • AUTOMATION ROLES • TAKE SMALL STEPS
•
• Take time for debriefing when you are through and don't forget to LEARN FROM MISTAKES
• the Test Automation Patterns wiki – Diagnostics – questions to help identify problems – ISSUES – common problems in automation – PATTERNS – proven ways to overcome problems
• in this tutorial – we will use an off-line version of the wiki if no
internet access in the room – gives you a chance to get started with it – answer any questions you have – prepare you to get the most benefit from it later
Feedback/discussion • discussion of issues, patterns, wiki
– did you use the diagnostic questions? • were they helpful?
– what issues & patterns did you look at? – what was most useful for you? – what else would be helpful? – any problems finding what you wanted? – how will you apply the patterns to your own
automation?
80
Using the wiki • this is a new resource that will grow • the more you add, the more valuable it will be
– please add your experiences of patterns, tips, problems, solutions
– email us with your ideas first • will can put your text up • or give you access to edit yourself