SlideShare a Scribd company logo
1 of 15
Download to read offline
Introduction to Automated Testing

    by Lars Thorup, ZeaLake
         May 26th 2011
Who is Lars Thorup?




• Software developer

• Coach: Teaching TDD and
  automated testing

• Advisor: Assesses software
  projects and companies

• Founder and CEO of
  BestBrains and ZeaLake
Why are we here today?

• How do we do automated testing?
   – Write test programs
   – Run the tests automatically

• Why should we write tests?
   –   Enjoy more efficient and predictable course of development
   –   Find and fix bugs fast
   –   Prevent bugs from reappearing
   –   Improve the design of our software
Different kinds of automated tests

• Unit tests
   – Tests individual pieces of code and the interaction between code blocks

• System tests
   – Tests the entire system against the requirements

• Performance tests
   – Tests non functional requirements
Unit tests or system tests?

• Unit tests are efficient
   –   Fast to run (a few seconds)
   –   Robust and predictable
   –   Easy to write
   –   Is written together with the code it is testing

• System tests are thorough
   – Tests all layers together
   – Most efficient way to create a set of tests for existing code
Can we automate performance tests?

• Performance tests are brittle
   – Tip: create performance trend curves instead
So, how do we actually do this?

• IsNumeric
  – C#
  – Ruby

• TransferFunds
  – C++
How do we run the tests automatically?

• From our programming environment (IDE)
   – Command line: make test
   – Right click | Run Tests

• On every commit
   – Setup a build server
       • Hudson / Jenkins
       • TeamCity
   – Let the build server run all tests
   – Get build notifications
   – Keep the build green
       • Fixing a broken build has priority over any other development task
How can tests help improve our design?

• The software design needs to evolve over time
• A refactoring modifies the design without changing behavior
• Tests ensure that behavior is not accidentally changed

• Without tests, refactoring is scary
   – and with no refactoring, the design decays over time

• With tests, we have the courage to refactor
   – so we continually keep our design healthy
What is good design?

• One element of good design is loose dependencies
   – Use interfaces (for static languages)
   – Inject dependencies

• Avoid this



• Do this instead
Are we wasting valuable developer time writing tests?

• No
• The time spent writing tests is not taken from the time spent
  coding
   – It is taken from the time otherwise spent on manual testing and debugging
• The cost of a bug keeps increasing until we fix it

• Find bugs fast
   – Avoid losing customer confidence
   – Free QA to do exploratory testing
     so they find the hard-to-find bugs
   – Spend less time trying to figure out
     what is causing the bug and how to fix it

• Avoid spending time testing again
How do we get started?

• When we have a lot of existing code without tests
   – Create a set of system tests to get a safety net

• When we are writing new code
   – Write unit tests in conjunction with the new code

• Set up a standard test environment for our specific application
   – Test data
       • Automate the creation of standard testdata in a local database
   – External dependencies
       • Write stubs to use in the tests
What does a real-world project look like?

• wizerize.com
    – Web application: C# and JavaScript
    – 3 years of production
    – 2-4 developers
•   40% test code, 60% production code (in lines of code)
•   71% code coverage of unit tests
•   614 unit tests – run in 1 minute
•   54 system tests – run in 20 minutes
•   No functional errors seen by end users in production (yet)
Where can I read more?

• http://googletesting.blogspot.com/
• http://testdrivendeveloper.com/
• http://codesheriff.blogspot.com/
Which tools do we use?

Environment           Tool
C#                    NUnit
JavaScript            qUnit
HTML-based UI         WatiN, Selenium
C++                   CppUnit, googletest
Python                unittest
Ruby                  Test::Unit
C                     check, cunit
Java                  JUnit
...                   ...

More Related Content

What's hot

Becoming a better programmer - unit testing
Becoming a better programmer - unit testingBecoming a better programmer - unit testing
Becoming a better programmer - unit testing
Duy Tan Geek
 

What's hot (20)

Continuous Integration at T3CON08
Continuous Integration at T3CON08Continuous Integration at T3CON08
Continuous Integration at T3CON08
 
Becoming a better programmer - unit testing
Becoming a better programmer - unit testingBecoming a better programmer - unit testing
Becoming a better programmer - unit testing
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Agile test practices
Agile test practicesAgile test practices
Agile test practices
 
Continuous integration, delivery & deployment
Continuous integration,  delivery & deploymentContinuous integration,  delivery & deployment
Continuous integration, delivery & deployment
 
Why your company loves to welcome change but sucks at accommodating it
Why your company loves to welcome change but sucks at accommodating itWhy your company loves to welcome change but sucks at accommodating it
Why your company loves to welcome change but sucks at accommodating it
 
QA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web AppsQA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web Apps
 
Agile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard ChengAgile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard Cheng
 
NYC MeetUp 10.9
NYC MeetUp 10.9NYC MeetUp 10.9
NYC MeetUp 10.9
 
Simple Continous Integration
Simple Continous IntegrationSimple Continous Integration
Simple Continous Integration
 
Using Crowdsourced Testing to Turbocharge your Development Team
Using Crowdsourced Testing to Turbocharge your Development TeamUsing Crowdsourced Testing to Turbocharge your Development Team
Using Crowdsourced Testing to Turbocharge your Development Team
 
Test Strategies in Microservices
Test Strategies in MicroservicesTest Strategies in Microservices
Test Strategies in Microservices
 
Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s Perspective
 
Dev/Test scenarios in DevOps world
Dev/Test scenarios in DevOps worldDev/Test scenarios in DevOps world
Dev/Test scenarios in DevOps world
 
Continuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonestContinuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonest
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Taking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and GitTaking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and Git
 
Benefits from AATs
Benefits from AATsBenefits from AATs
Benefits from AATs
 
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 

Viewers also liked

Viewers also liked (6)

Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
 
Advanced Javascript Unit Testing
Advanced Javascript Unit TestingAdvanced Javascript Unit Testing
Advanced Javascript Unit Testing
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-tests
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to choose
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
 
10 Benefits of Automated Testing
10 Benefits of Automated Testing10 Benefits of Automated Testing
10 Benefits of Automated Testing
 

Similar to Introduction to-automated-testing

Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Jacinto Limjap
 

Similar to Introduction to-automated-testing (20)

Topic production code
Topic production codeTopic production code
Topic production code
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with Fitnesse
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
Bootstrapping Quality
Bootstrapping QualityBootstrapping Quality
Bootstrapping Quality
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Making software development processes to work for you
Making software development processes to work for youMaking software development processes to work for you
Making software development processes to work for you
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test Automation5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test Automation
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Agile, DevOps & Test
Agile, DevOps & TestAgile, DevOps & Test
Agile, DevOps & Test
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Software testing
Software testingSoftware testing
Software testing
 

More from BestBrains

More from BestBrains (20)

Psykologien i agile teams
Psykologien i agile teamsPsykologien i agile teams
Psykologien i agile teams
 
Bliv en haj til nedbrydning okt 2016
Bliv en haj til nedbrydning okt 2016 Bliv en haj til nedbrydning okt 2016
Bliv en haj til nedbrydning okt 2016
 
Vsm best brains presentation_ september 2016_v4 2
Vsm best brains presentation_ september 2016_v4 2Vsm best brains presentation_ september 2016_v4 2
Vsm best brains presentation_ september 2016_v4 2
 
Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09
 
BestBrains café-møde: Kanban med Lego ved Jesper Thaning
BestBrains café-møde: Kanban med Lego ved Jesper ThaningBestBrains café-møde: Kanban med Lego ved Jesper Thaning
BestBrains café-møde: Kanban med Lego ved Jesper Thaning
 
Projektleder i agilt setup, cafemøde hos BestBrains, april 2016
Projektleder i agilt setup, cafemøde hos BestBrains, april 2016Projektleder i agilt setup, cafemøde hos BestBrains, april 2016
Projektleder i agilt setup, cafemøde hos BestBrains, april 2016
 
BestBrains café-møde d. 14. april: Retrospektiv antipatterns
BestBrains café-møde d. 14. april: Retrospektiv antipatternsBestBrains café-møde d. 14. april: Retrospektiv antipatterns
BestBrains café-møde d. 14. april: Retrospektiv antipatterns
 
Gør urværket synligt for dine teams
Gør urværket synligt for dine teamsGør urværket synligt for dine teams
Gør urværket synligt for dine teams
 
Tddbdd workshop
Tddbdd workshopTddbdd workshop
Tddbdd workshop
 
Craftsmanship 2016 -BestBrains Café-møder
Craftsmanship 2016 -BestBrains Café-møderCraftsmanship 2016 -BestBrains Café-møder
Craftsmanship 2016 -BestBrains Café-møder
 
Best brains kanban med lego januar 2016 handout
Best brains kanban med lego januar 2016 handoutBest brains kanban med lego januar 2016 handout
Best brains kanban med lego januar 2016 handout
 
Bliv en ørn til estimering nov 2015
Bliv en ørn til estimering nov 2015Bliv en ørn til estimering nov 2015
Bliv en ørn til estimering nov 2015
 
Den agile transformation november 2015
Den agile transformation november 2015Den agile transformation november 2015
Den agile transformation november 2015
 
Sandheden om agile udviklingsteams
Sandheden om agile udviklingsteamsSandheden om agile udviklingsteams
Sandheden om agile udviklingsteams
 
Intro til agile 31 aug 2015
Intro til agile 31 aug 2015Intro til agile 31 aug 2015
Intro til agile 31 aug 2015
 
Lær 3 agile metoder på en aften, august 2015
Lær 3 agile metoder på en aften, august 2015Lær 3 agile metoder på en aften, august 2015
Lær 3 agile metoder på en aften, august 2015
 
Bliv en haj til nedbrydning, aug 2015.
Bliv en haj til nedbrydning, aug 2015.Bliv en haj til nedbrydning, aug 2015.
Bliv en haj til nedbrydning, aug 2015.
 
Haj til nedbrydning juni 2015
Haj til nedbrydning juni 2015Haj til nedbrydning juni 2015
Haj til nedbrydning juni 2015
 
Motivation - fedt, farligt & flygtigt.
Motivation - fedt, farligt & flygtigt.Motivation - fedt, farligt & flygtigt.
Motivation - fedt, farligt & flygtigt.
 
Switch -den_agile_omstilling
Switch  -den_agile_omstillingSwitch  -den_agile_omstilling
Switch -den_agile_omstilling
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Introduction to-automated-testing

  • 1. Introduction to Automated Testing by Lars Thorup, ZeaLake May 26th 2011
  • 2. Who is Lars Thorup? • Software developer • Coach: Teaching TDD and automated testing • Advisor: Assesses software projects and companies • Founder and CEO of BestBrains and ZeaLake
  • 3. Why are we here today? • How do we do automated testing? – Write test programs – Run the tests automatically • Why should we write tests? – Enjoy more efficient and predictable course of development – Find and fix bugs fast – Prevent bugs from reappearing – Improve the design of our software
  • 4. Different kinds of automated tests • Unit tests – Tests individual pieces of code and the interaction between code blocks • System tests – Tests the entire system against the requirements • Performance tests – Tests non functional requirements
  • 5. Unit tests or system tests? • Unit tests are efficient – Fast to run (a few seconds) – Robust and predictable – Easy to write – Is written together with the code it is testing • System tests are thorough – Tests all layers together – Most efficient way to create a set of tests for existing code
  • 6. Can we automate performance tests? • Performance tests are brittle – Tip: create performance trend curves instead
  • 7. So, how do we actually do this? • IsNumeric – C# – Ruby • TransferFunds – C++
  • 8. How do we run the tests automatically? • From our programming environment (IDE) – Command line: make test – Right click | Run Tests • On every commit – Setup a build server • Hudson / Jenkins • TeamCity – Let the build server run all tests – Get build notifications – Keep the build green • Fixing a broken build has priority over any other development task
  • 9. How can tests help improve our design? • The software design needs to evolve over time • A refactoring modifies the design without changing behavior • Tests ensure that behavior is not accidentally changed • Without tests, refactoring is scary – and with no refactoring, the design decays over time • With tests, we have the courage to refactor – so we continually keep our design healthy
  • 10. What is good design? • One element of good design is loose dependencies – Use interfaces (for static languages) – Inject dependencies • Avoid this • Do this instead
  • 11. Are we wasting valuable developer time writing tests? • No • The time spent writing tests is not taken from the time spent coding – It is taken from the time otherwise spent on manual testing and debugging • The cost of a bug keeps increasing until we fix it • Find bugs fast – Avoid losing customer confidence – Free QA to do exploratory testing so they find the hard-to-find bugs – Spend less time trying to figure out what is causing the bug and how to fix it • Avoid spending time testing again
  • 12. How do we get started? • When we have a lot of existing code without tests – Create a set of system tests to get a safety net • When we are writing new code – Write unit tests in conjunction with the new code • Set up a standard test environment for our specific application – Test data • Automate the creation of standard testdata in a local database – External dependencies • Write stubs to use in the tests
  • 13. What does a real-world project look like? • wizerize.com – Web application: C# and JavaScript – 3 years of production – 2-4 developers • 40% test code, 60% production code (in lines of code) • 71% code coverage of unit tests • 614 unit tests – run in 1 minute • 54 system tests – run in 20 minutes • No functional errors seen by end users in production (yet)
  • 14. Where can I read more? • http://googletesting.blogspot.com/ • http://testdrivendeveloper.com/ • http://codesheriff.blogspot.com/
  • 15. Which tools do we use? Environment Tool C# NUnit JavaScript qUnit HTML-based UI WatiN, Selenium C++ CppUnit, googletest Python unittest Ruby Test::Unit C check, cunit Java JUnit ... ...