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

PDF
Extreme Programming - to the next-level
PDF
Automated Performance Testing
PDF
Fast end-to-end-tests
PDF
Put "fast" back in "fast feedback"
PDF
QA Strategies for Testing Legacy Web Apps
PDF
Using Crowdsourced Testing to Turbocharge your Development Team
PDF
UPC Plone Testing Talk
PDF
Unit testing
Extreme Programming - to the next-level
Automated Performance Testing
Fast end-to-end-tests
Put "fast" back in "fast feedback"
QA Strategies for Testing Legacy Web Apps
Using Crowdsourced Testing to Turbocharge your Development Team
UPC Plone Testing Talk
Unit testing

What's hot (20)

PPT
icebreakerwithdevops-150218112943-conversion-gate02
PDF
Why You Should Start Using Docker
PPTX
Project management frameworks for software developing
PPTX
Develop 4 Developers
PPTX
QA Automation testing online training
PDF
testmon for Python
PPTX
Agile Software Development Techniques for Daily Use
ODP
OpenNTF Essentials
PPTX
Introduction to DevOps. Continuous Integration by Myroslav Dmytrus
PDF
Putting the pro in programmer
PPT
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
PPTX
That worked before
PDF
The art of being an agile programmer
PDF
SeleniumCamp 2015 Andrii Soldatenko
PDF
Improve the deployment process step by step
PDF
Survival of the Continuist
PDF
User story workflow (eng)
PDF
Андрей Солдатенко. Разработка высокопроизводительныx функциональных тестов д...
PDF
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
PPTX
Selenium done right
icebreakerwithdevops-150218112943-conversion-gate02
Why You Should Start Using Docker
Project management frameworks for software developing
Develop 4 Developers
QA Automation testing online training
testmon for Python
Agile Software Development Techniques for Daily Use
OpenNTF Essentials
Introduction to DevOps. Continuous Integration by Myroslav Dmytrus
Putting the pro in programmer
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
That worked before
The art of being an agile programmer
SeleniumCamp 2015 Andrii Soldatenko
Improve the deployment process step by step
Survival of the Continuist
User story workflow (eng)
Андрей Солдатенко. Разработка высокопроизводительныx функциональных тестов д...
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
Selenium done right
Ad

Similar to Introduction to Automated Testing (20)

PPTX
Topic production code
PDF
Agile Acceptance testing with Fitnesse
PPT
Test Driven Development and Automation
PPTX
Software_Testing_Presentationsinsds.pptx
PPTX
Lean-Agile Development with SharePoint - Bill Ayers
PPTX
Bootstrapping Quality
PDF
Why your company loves to welcome change but sucks at accommodating it
PPTX
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
PPTX
Continuous integration, delivery & deployment
PPTX
Making software development processes to work for you
PDF
TDD and Related Techniques for Non Developers (2012)
PPTX
Software Testing_A_mmmmmmmmmmmmmmmmmmmmm
PPTX
Test automation proposal
PPTX
Tools for Software Testing
PPTX
Battle for Code Quality - A Story of One Java Project
PDF
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
PDF
NYC MeetUp 10.9
PDF
Unit Testing in JavaScript
PPT
Test Driven Development
PDF
5 Steps to Jump Start Your Test Automation
Topic production code
Agile Acceptance testing with Fitnesse
Test Driven Development and Automation
Software_Testing_Presentationsinsds.pptx
Lean-Agile Development with SharePoint - Bill Ayers
Bootstrapping Quality
Why your company loves to welcome change but sucks at accommodating it
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Continuous integration, delivery & deployment
Making software development processes to work for you
TDD and Related Techniques for Non Developers (2012)
Software Testing_A_mmmmmmmmmmmmmmmmmmmmm
Test automation proposal
Tools for Software Testing
Battle for Code Quality - A Story of One Java Project
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
NYC MeetUp 10.9
Unit Testing in JavaScript
Test Driven Development
5 Steps to Jump Start Your Test Automation
Ad

More from Lars Thorup (16)

PDF
100 tests per second - 40 releases per week
PDF
SQL or NoSQL - how to choose
PDF
Super fast end-to-end-tests
PDF
Advanced Javascript Unit Testing
PDF
Unit testing legacy code
PDF
Advanced QUnit - Front-End JavaScript Unit Testing
PDF
Database Schema Evolution
PDF
Advanced Jasmine - Front-End JavaScript Unit Testing
PDF
Javascript unit testing with QUnit and Sinon
PDF
Continuous Integration for front-end JavaScript
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
Agile Contracts
PDF
High Performance Software Engineering Teams
PDF
Elephant Carpaccio
PDF
Automated Testing for Embedded Software in C or C++
PDF
Unit Testing in JavaScript with MVC and QUnit
100 tests per second - 40 releases per week
SQL or NoSQL - how to choose
Super fast end-to-end-tests
Advanced Javascript Unit Testing
Unit testing legacy code
Advanced QUnit - Front-End JavaScript Unit Testing
Database Schema Evolution
Advanced Jasmine - Front-End JavaScript Unit Testing
Javascript unit testing with QUnit and Sinon
Continuous Integration for front-end JavaScript
Test and Behaviour Driven Development (TDD/BDD)
Agile Contracts
High Performance Software Engineering Teams
Elephant Carpaccio
Automated Testing for Embedded Software in C or C++
Unit Testing in JavaScript with MVC and QUnit

Recently uploaded (20)

PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
DOCX
search engine optimization ppt fir known well about this
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Flame analysis and combustion estimation using large language and vision assi...
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Data Virtualization in Action: Scaling APIs and Apps with FME
sustainability-14-14877-v2.pddhzftheheeeee
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Enhancing plagiarism detection using data pre-processing and machine learning...
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
search engine optimization ppt fir known well about this
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Co-training pseudo-labeling for text classification with support vector machi...
Taming the Chaos: How to Turn Unstructured Data into Decisions
NewMind AI Weekly Chronicles – August ’25 Week IV
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
giants, standing on the shoulders of - by Daniel Stenberg
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Improvisation in detection of pomegranate leaf disease using transfer learni...

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