Effective Test Automation
in an Agile Environment
Krishantha Samaraweera
Senior Technical Lead – Test Automation
WSO2
Agenda
â—Ź Automated testing
â—Ź Success stories
● Automation Basics – Test Pyramid
â—Ź WSO2 Test Automation Framework
â—Ź WSO2 Platform Automated Test Suite
â—Ź Lesson learned
â—Ź Automation Basics - Best Practices
â—Ź Continuous integration and Continuous Delivery
What is Test Automation
● Automation testing – Testing which can be done programmatically
● Compare result – Actual and Expected
â—Ź Generate reports
â—Ź Goal is to reduce the number of test cases to run manually
â—Ź Not to eliminate Manual testing all together
Why Automated Testing
â—Ź To get early and instance feedback
â—Ź Safety net to save time and which is reinvented in to manual
testing.
â—Ź Doesn't require human intervention.
â—Ź Unattended (Overnight)
â—Ź Manual testing has high risk of mission out on something
Success Stories
â—Ź Google runs 100M+ automated test cases every day
â—Ź Google customer surveys team can deliver a change to
production 8 mins after code is committed.
â—Ź Ebay runs 35000 test cases in 5 hours
â—Ź At Facebook, each of 5,000 engineers commits to trunk HEAD
at least once a day and the code at trunk HEAD is pushed to
production once daily.
â—Ź Atlassian JIRA is protected by over 14,000 unit tests and
19,000 functional tests from regressions
Success Stories Cont'd..
â—Ź Etsy used to take 14 hours and an army of people to deploy
one release into production before CD kicked in. Now it takes
15 mins, 1 person. They did 729 deployments to production in
Nov 2010, only 6 deployment related incidents.
â—Ź At Amazon, new code is deployed to production at a
staggering rate of once every 11.6 seconds during a normal
business day.
● That’s 3,000 production deployments per day.
Test Automaton Pyramid
Test Automation Pyramid Cont'd..
WSO2 Test Automation Framework
â—Ź Why our own framework
– Open source test scripts
– Stay lean
– Independent
– Single framework for all products
– Facilitate backend testing + UI tests
Technology outlineTechnology outline
Test Automation Framework Architecture
Glimpse of Test Automation Framework
â—Ź Simple automation context API.
â—Ź Platform wide test execution support.
â—Ź Annotation based test execution management support.
â—Ź Test reports and coverage report generation.
â—Ź Test tooling integration (Jmeter).
â—Ź Selenium WebDriver integration and ability to run UI tests on
cross browser environments.
â—Ź Framework extensibility capability through pluggable modules.
â—Ź Easy retrieval of new configurations.
WSO2 Platform Automate Test Suite
â—Ź Package tests for other people to use
â—Ź Distribution contain all product integration tests and platform
tests jars.
â—Ź Test script management tool
â—Ź Ant based test executor
â—Ź Test execution on distributed product clustered or cloud
deployment.
â—Ź Cross platform test execution
Lesson Learned
â—Ź Once you abandon the maintenance of the automation, it is
likely to die. For a better chance of success, choose an
automation approach that will require the least maintenance.
â—Ź Automation requiring multiple cycles and project releases for it
to become fully effective and provide an acceptable ROI.
â—Ź Start by automating the most valuable tests.
Lesson Learned Cont'd
â—Ź Plan your test automation at the beginning of the project.
● Unit Testing FIRST – Fix your test Pyramid.
â—Ź Staff should know how to diagnose failures. Minimize calling
automators for every issue
Lesson Learned Cont'd..
â—Ź Automation development requires the same discipline as
software development.
â—Ź Without the cooperation of developers, test automation will be
more difficult than it needs to be.
â—Ź Everyone should know what is automated.
Test Automation Benefits – Efficiency ROI
Time savings of test execution with automation vs test
execution without automation
Product # of Tests Manual time
per test
case
Iterations Total time
of manual
test
execution
Saved time
ESB 922 8 min 5 384 hours 77 man days
G-Reg 1557 8 min 5 1038 hours 130 man days
Continuous Integration
â—Ź Continuous Integration is a software development practice
â—Ź Team integrate their work frequently
â—Ź Each integration is verified by automated build
â—Ź Rapid feedback
â—Ź Ships better code faster
Continuous Integration Cont'd..
Source : http://mikeciblogs.wordpress.com/2010/06/15/continuous-integration-for-agile-project-managers-part-3/
Continuous Delivery
How long would it take your organization to deploy a change [to
production] that involves just one single line of code? Do you do
this on a repeatable, reliable basis?”
- Mary and Tom Poppendieck,
Implementing Lean Software Development
Continuous Delivery
Build software in such a way that it ready to be released at any
time
– Continuous feedback
– Reduce risk of failures in production system
– Rapid, reliable and repeatable processes – automation!!
Test Cases to be Automated
● HIGH RISK – Business critical test cases.
â—Ź Features trend to break frequently
â—Ź Repetitive tasks are good candidate for automation
â—Ź Test cases that are tedious or difficult to perform manually
â—Ź Test cases which are time consuming.
â—Ź Tests that use multiple data values for the same actions
â—Ź Smoke Tests
Test Cases not suitable for Automation
● Test cases that are newly designed – Not executed manually
at least once.
â—Ź Test cases for which the requirements are changing frequently.
● Usability testing – “How easy is the application to use?”
â—Ź One-time testing
Testing Philosophy
â—Ź You don't have to write 1,000 tests
â—Ź The benefit of the tests scales very nicely.
– 1,000 tests is good
– 100 tests is also good
– 10 tests is also good
â—Ź And even one test is better than no tests at all
Testing Philosophy
â—Ź So don't start out by saying "Oh, I have to write 1,000 tests for
this."
â—Ź Then you might not write any at all.
â—Ź Start by saying "I'll write one test".
â—Ź Then write it
â—Ź Then maybe write another one
â—Ź You will immediately see the benefit of having one test
Conclusion
Importance players of successful test automation are right
selection of tools, testing process and team.
Writing tests will make you happy. If you make it into a big
routing task, you won't do it. So don't make it into a big routine
task.
Effective tests can be extremely simple.
References
[1]“GTAC 2013: Presentations - Google Test Automation Conference — Google Developers.” [Online]. Available:
https://developers.google.com/google-test-automation-conference/2013/presentations. [Accessed: 17-Mar-2014].
[2]“Continuous Integration for Agile Project Managers (Part 3) | Mike CI blogs.” [Online]. Available:
http://mikeciblogs.wordpress.com/2010/06/15/continuous-integration-for-agile-project-managers-part-3/. [Accessed:
17-Mar-2014].
[3]“All About Automated Testing.” [Online]. Available: http://www.guru99.com/automation-testing.html. [Accessed:
17-Mar-2014].
[4]“Writing Automated Tests.” [Online]. Available: http://perl.plover.com/yak/testing/samples/. [Accessed: 17-Mar-2014].
[5]“Continuous Integration.” [Online]. Available: http://martinfowler.com/articles/continuousIntegration.html. [Accessed:
17-Mar-2014].
Thank You

Wso2con test-automation

  • 1.
    Effective Test Automation inan Agile Environment Krishantha Samaraweera Senior Technical Lead – Test Automation WSO2
  • 2.
    Agenda ● Automated testing ●Success stories ● Automation Basics – Test Pyramid ● WSO2 Test Automation Framework ● WSO2 Platform Automated Test Suite ● Lesson learned ● Automation Basics - Best Practices ● Continuous integration and Continuous Delivery
  • 3.
    What is TestAutomation ● Automation testing – Testing which can be done programmatically ● Compare result – Actual and Expected ● Generate reports ● Goal is to reduce the number of test cases to run manually ● Not to eliminate Manual testing all together
  • 4.
    Why Automated Testing â—ŹTo get early and instance feedback â—Ź Safety net to save time and which is reinvented in to manual testing. â—Ź Doesn't require human intervention. â—Ź Unattended (Overnight) â—Ź Manual testing has high risk of mission out on something
  • 5.
    Success Stories â—Ź Googleruns 100M+ automated test cases every day â—Ź Google customer surveys team can deliver a change to production 8 mins after code is committed. â—Ź Ebay runs 35000 test cases in 5 hours â—Ź At Facebook, each of 5,000 engineers commits to trunk HEAD at least once a day and the code at trunk HEAD is pushed to production once daily. â—Ź Atlassian JIRA is protected by over 14,000 unit tests and 19,000 functional tests from regressions
  • 6.
    Success Stories Cont'd.. ●Etsy used to take 14 hours and an army of people to deploy one release into production before CD kicked in. Now it takes 15 mins, 1 person. They did 729 deployments to production in Nov 2010, only 6 deployment related incidents. ● At Amazon, new code is deployed to production at a staggering rate of once every 11.6 seconds during a normal business day. ● That’s 3,000 production deployments per day.
  • 7.
  • 8.
  • 9.
    WSO2 Test AutomationFramework ● Why our own framework – Open source test scripts – Stay lean – Independent – Single framework for all products – Facilitate backend testing + UI tests
  • 10.
  • 11.
  • 12.
    Glimpse of TestAutomation Framework â—Ź Simple automation context API. â—Ź Platform wide test execution support. â—Ź Annotation based test execution management support. â—Ź Test reports and coverage report generation. â—Ź Test tooling integration (Jmeter). â—Ź Selenium WebDriver integration and ability to run UI tests on cross browser environments. â—Ź Framework extensibility capability through pluggable modules. â—Ź Easy retrieval of new configurations.
  • 13.
    WSO2 Platform AutomateTest Suite â—Ź Package tests for other people to use â—Ź Distribution contain all product integration tests and platform tests jars. â—Ź Test script management tool â—Ź Ant based test executor â—Ź Test execution on distributed product clustered or cloud deployment. â—Ź Cross platform test execution
  • 14.
    Lesson Learned â—Ź Onceyou abandon the maintenance of the automation, it is likely to die. For a better chance of success, choose an automation approach that will require the least maintenance. â—Ź Automation requiring multiple cycles and project releases for it to become fully effective and provide an acceptable ROI. â—Ź Start by automating the most valuable tests.
  • 15.
    Lesson Learned Cont'd ●Plan your test automation at the beginning of the project. ● Unit Testing FIRST – Fix your test Pyramid. ● Staff should know how to diagnose failures. Minimize calling automators for every issue
  • 16.
    Lesson Learned Cont'd.. â—ŹAutomation development requires the same discipline as software development. â—Ź Without the cooperation of developers, test automation will be more difficult than it needs to be. â—Ź Everyone should know what is automated.
  • 17.
    Test Automation Benefits– Efficiency ROI Time savings of test execution with automation vs test execution without automation Product # of Tests Manual time per test case Iterations Total time of manual test execution Saved time ESB 922 8 min 5 384 hours 77 man days G-Reg 1557 8 min 5 1038 hours 130 man days
  • 18.
    Continuous Integration â—Ź ContinuousIntegration is a software development practice â—Ź Team integrate their work frequently â—Ź Each integration is verified by automated build â—Ź Rapid feedback â—Ź Ships better code faster
  • 19.
    Continuous Integration Cont'd.. Source: http://mikeciblogs.wordpress.com/2010/06/15/continuous-integration-for-agile-project-managers-part-3/
  • 20.
    Continuous Delivery How longwould it take your organization to deploy a change [to production] that involves just one single line of code? Do you do this on a repeatable, reliable basis?” - Mary and Tom Poppendieck, Implementing Lean Software Development
  • 21.
    Continuous Delivery Build softwarein such a way that it ready to be released at any time – Continuous feedback – Reduce risk of failures in production system – Rapid, reliable and repeatable processes – automation!!
  • 22.
    Test Cases tobe Automated ● HIGH RISK – Business critical test cases. ● Features trend to break frequently ● Repetitive tasks are good candidate for automation ● Test cases that are tedious or difficult to perform manually ● Test cases which are time consuming. ● Tests that use multiple data values for the same actions ● Smoke Tests
  • 23.
    Test Cases notsuitable for Automation ● Test cases that are newly designed – Not executed manually at least once. ● Test cases for which the requirements are changing frequently. ● Usability testing – “How easy is the application to use?” ● One-time testing
  • 24.
    Testing Philosophy ● Youdon't have to write 1,000 tests ● The benefit of the tests scales very nicely. – 1,000 tests is good – 100 tests is also good – 10 tests is also good ● And even one test is better than no tests at all
  • 25.
    Testing Philosophy â—Ź Sodon't start out by saying "Oh, I have to write 1,000 tests for this." â—Ź Then you might not write any at all. â—Ź Start by saying "I'll write one test". â—Ź Then write it â—Ź Then maybe write another one â—Ź You will immediately see the benefit of having one test
  • 26.
    Conclusion Importance players ofsuccessful test automation are right selection of tools, testing process and team. Writing tests will make you happy. If you make it into a big routing task, you won't do it. So don't make it into a big routine task. Effective tests can be extremely simple.
  • 27.
    References [1]“GTAC 2013: Presentations- Google Test Automation Conference — Google Developers.” [Online]. Available: https://developers.google.com/google-test-automation-conference/2013/presentations. [Accessed: 17-Mar-2014]. [2]“Continuous Integration for Agile Project Managers (Part 3) | Mike CI blogs.” [Online]. Available: http://mikeciblogs.wordpress.com/2010/06/15/continuous-integration-for-agile-project-managers-part-3/. [Accessed: 17-Mar-2014]. [3]“All About Automated Testing.” [Online]. Available: http://www.guru99.com/automation-testing.html. [Accessed: 17-Mar-2014]. [4]“Writing Automated Tests.” [Online]. Available: http://perl.plover.com/yak/testing/samples/. [Accessed: 17-Mar-2014]. [5]“Continuous Integration.” [Online]. Available: http://martinfowler.com/articles/continuousIntegration.html. [Accessed: 17-Mar-2014].
  • 28.