SlideShare a Scribd company logo
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 (20)

PPT
icebreakerwithdevops-150218112943-conversion-gate02
Manohar Kumar
 
PDF
Why You Should Start Using Docker
Alexandru Bolboaca
 
PPTX
Project management frameworks for software developing
Vicente Bolea
 
PPTX
Develop 4 Developers
Christian Güdemann
 
PPTX
QA Automation testing online training
Divya Shree
 
PDF
testmon for Python
tib0r
 
PPTX
Agile Software Development Techniques for Daily Use
Hristo Iliev
 
ODP
OpenNTF Essentials
Christian Güdemann
 
PPTX
Introduction to DevOps. Continuous Integration by Myroslav Dmytrus
Binary Studio
 
PDF
Putting the pro in programmer
Switch Systems Ltd
 
PPT
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
meet_magento
 
PPTX
That worked before
Christian Güdemann
 
PDF
The art of being an agile programmer
Claudia Rosu
 
PDF
SeleniumCamp 2015 Andrii Soldatenko
Andrii Soldatenko
 
PDF
Improve the deployment process step by step
Daniel Fahlke
 
PDF
Survival of the Continuist
Paul Blundell
 
PDF
User story workflow (eng)
Anatoliy Okhotnikov
 
PDF
Андрей Солдатенко. Разработка высокопроизводительныx функциональных тестов д...
Alina Dolgikh
 
PDF
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
Stephen Garrett
 
PPTX
Selenium done right
Tal Landa
 
icebreakerwithdevops-150218112943-conversion-gate02
Manohar Kumar
 
Why You Should Start Using Docker
Alexandru Bolboaca
 
Project management frameworks for software developing
Vicente Bolea
 
Develop 4 Developers
Christian Güdemann
 
QA Automation testing online training
Divya Shree
 
testmon for Python
tib0r
 
Agile Software Development Techniques for Daily Use
Hristo Iliev
 
OpenNTF Essentials
Christian Güdemann
 
Introduction to DevOps. Continuous Integration by Myroslav Dmytrus
Binary Studio
 
Putting the pro in programmer
Switch Systems Ltd
 
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
meet_magento
 
That worked before
Christian Güdemann
 
The art of being an agile programmer
Claudia Rosu
 
SeleniumCamp 2015 Andrii Soldatenko
Andrii Soldatenko
 
Improve the deployment process step by step
Daniel Fahlke
 
Survival of the Continuist
Paul Blundell
 
User story workflow (eng)
Anatoliy Okhotnikov
 
Андрей Солдатенко. Разработка высокопроизводительныx функциональных тестов д...
Alina Dolgikh
 
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
Stephen Garrett
 
Selenium done right
Tal Landa
 

Similar to Introduction to Automated Testing (20)

PDF
Agile Testing Pasadena JUG Aug2009
Grig Gheorghiu
 
PDF
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
PPT
Automated testing overview
Alex Pop
 
PDF
Agile Acceptance testing with Fitnesse
ClareMcLennan
 
PPT
Automated testing vs manual testing
Neha Polke
 
PPTX
Making the Unstable Stable - An Intro To Testing
Cameron Presley
 
PDF
High Performance Software Engineering Teams
Lars Thorup
 
PPTX
Testing 101
Noam Barkai
 
PPTX
Unit Testing and TDD 2017
Xavi Hidalgo
 
PDF
Engaging IV&V Testing Services for Agile Projects
Ravi Kumar
 
PDF
Continuous Integration testing based on Selenium and Hudson
Zbyszek Mockun
 
PDF
Open Source tools in Continuous Integration environment (case study for agil...
suwalki24.pl
 
PDF
DSR Testing (Part 1)
Steve Upton
 
PDF
Automated testing-whitepaper
imdurgesh
 
PPTX
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
PPTX
Testing Sap: Modern Methodology
Ethan Jewett
 
PDF
Testing In Agile
Ari Tanninen
 
PPTX
Software testing
Nico Heidtke
 
PPT
39.Testing-Part3.ppt
SapnaRastogi3
 
PPTX
Unit testing & TDD concepts with best practice guidelines.
Mohamed Taman
 
Agile Testing Pasadena JUG Aug2009
Grig Gheorghiu
 
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Automated testing overview
Alex Pop
 
Agile Acceptance testing with Fitnesse
ClareMcLennan
 
Automated testing vs manual testing
Neha Polke
 
Making the Unstable Stable - An Intro To Testing
Cameron Presley
 
High Performance Software Engineering Teams
Lars Thorup
 
Testing 101
Noam Barkai
 
Unit Testing and TDD 2017
Xavi Hidalgo
 
Engaging IV&V Testing Services for Agile Projects
Ravi Kumar
 
Continuous Integration testing based on Selenium and Hudson
Zbyszek Mockun
 
Open Source tools in Continuous Integration environment (case study for agil...
suwalki24.pl
 
DSR Testing (Part 1)
Steve Upton
 
Automated testing-whitepaper
imdurgesh
 
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
Testing Sap: Modern Methodology
Ethan Jewett
 
Testing In Agile
Ari Tanninen
 
Software testing
Nico Heidtke
 
39.Testing-Part3.ppt
SapnaRastogi3
 
Unit testing & TDD concepts with best practice guidelines.
Mohamed Taman
 
Ad

More from Lars Thorup (14)

PDF
100 tests per second - 40 releases per week
Lars Thorup
 
PDF
SQL or NoSQL - how to choose
Lars Thorup
 
PDF
Super fast end-to-end-tests
Lars Thorup
 
PDF
Advanced Javascript Unit Testing
Lars Thorup
 
PDF
Unit testing legacy code
Lars Thorup
 
PDF
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
PDF
Database Schema Evolution
Lars Thorup
 
PDF
Advanced Jasmine - Front-End JavaScript Unit Testing
Lars Thorup
 
PDF
Javascript unit testing with QUnit and Sinon
Lars Thorup
 
PDF
Continuous Integration for front-end JavaScript
Lars Thorup
 
PDF
Agile Contracts
Lars Thorup
 
PDF
Elephant Carpaccio
Lars Thorup
 
PDF
Automated Testing for Embedded Software in C or C++
Lars Thorup
 
PDF
Unit Testing in JavaScript with MVC and QUnit
Lars Thorup
 
100 tests per second - 40 releases per week
Lars Thorup
 
SQL or NoSQL - how to choose
Lars Thorup
 
Super fast end-to-end-tests
Lars Thorup
 
Advanced Javascript Unit Testing
Lars Thorup
 
Unit testing legacy code
Lars Thorup
 
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
Database Schema Evolution
Lars Thorup
 
Advanced Jasmine - Front-End JavaScript Unit Testing
Lars Thorup
 
Javascript unit testing with QUnit and Sinon
Lars Thorup
 
Continuous Integration for front-end JavaScript
Lars Thorup
 
Agile Contracts
Lars Thorup
 
Elephant Carpaccio
Lars Thorup
 
Automated Testing for Embedded Software in C or C++
Lars Thorup
 
Unit Testing in JavaScript with MVC and QUnit
Lars Thorup
 
Ad

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

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 ... ...