SlideShare a Scribd company logo
Automated testing overview
February 2012
Summary
• Why do we need software testing
• Software testing definition
• Types of testing
• Why do we need automated testing
• Unit testing for simple objects
• Unit testing for objects that have
dependencies
• Automated testing for user interface
Why do we need software testing
• To reduce operating costs : software bugs are a
big cost for the business;
• To protect company reputation : software
quality is a key requirement of any new project;
• any developer will do some kind of testing
before delivering the software to the client;
• software testing is a core activity associated
with the development process;
Software testing definition
• Definition: Software testing is an investigation
conducted to provide stakeholders with
information about the quality of the product
or service under test;
• software testing verifies and validates that the
software deliverable:
– meets the business and technical requirements that
guided its design and development;
– works as expected;
Types of testing
• system testing : exercises the application end
to end. Based on specifications and executed
using tests scripts as part of a test plan.
• integration testing : targets parts of the
application e.g. the service layer;
• unit testing : tests individual code units : e.g.
classes.
Cost of software bugs
Cost to fix a defect
Time detected
Requirem
ents
Architectu
re
Constructi
on
System
test
After
release
Time
introd
uced
Requirement
s
1x 3x 5-10x 10x 10-100x
Architecture - 1x 10x 15x 25-100x
Construction - - 1x 10x 10-25x
• the cost of removing a software bug is linked to the development stage the
software bug is found;
Difficulties of software testing
• It is a lengthy process and can happen only after the
alpha stage of the application;
• Constant retesting : After each release we need to
test new features and retest existing ones - even if
the changes affect only a part of the application we
can never be sure that the rest of the application is
unaffected;
• Usually the full test plan is applied right at the end of
the delivery cycle : regression errors or unexpected
errors can be detected too close to final delivery -
they can affect the delivery schedule;
Solution: automated tests
• Automate the test plan right from the beginning of
the development cycle : the developer can now
exercise the application before is deployed to
testing;
• System testing will always have a manual part but
can be also comprised of automated tests that can
cover a lot of scenarios
• Use unit testing and integration testing extensively
as they can be automated with minimal costs;
Why do we need automated testing
• TIME - speed up the delivery schedule : the test
window is reduced and testers can concentrate more
on exploratory testing and test cases that cannot be
automated;
• COST - reduce the number of bugs : bugs can be
detected before a deployment is made and
regression issues are reduced significantly;
• SCOPE - reduce the amount of rework and make
scope changes cheap: the testers, business analysts
and developers will start from test scenarios first
that will increase the product knowledge right from
the start;
How to implement automated tests
• The application need to be testable;
• System testing : coded ui tests using an automation
framework or using record and replay tools;
• Integrations tests : inject data that is used to exercise
the application layers for specific scenarios;
• Unit testing : they are code only tests so they don’t
have an impact on external systems and their
dependencies
Unit testing
What is a unit test
• Can I run and get results from a unit test I wrote two
weeks or even months or years ago?
• Can any member of my team run and get the results
from unit tests I wrote two months ago?
• Can I run all the unit tests I’ve written in no more than
a few minutes?
• Can I run all the unit tests I’ve written at the push of a
button?
• Can I write a basic unit test in no more than a few
minutes?
Properties of a good unit test
• It should be automated and repeatable.
• It should be easy to implement.
• Once it’s written, it should remain for future
use.
• Anyone should be able to run it.
• It should run at the push of a button.
• It should run quickly.
Styles of writing unit tests
• write production code first then unit tests;
• test driven development(TDD): write the unit
tests first then production code;
• behaviour driven development(BDD): start
from user stories and decompose them in
scenarios then write code to validate the
scenarios
Unit testing naming conventions used
in examples
Object to be tested Object to create on the testing side
Project Create a test project named [ProjectUnderTest].Tests.
Class For each class, create at least one class with the name
[ClassName]Tests.
Method For each method, create at least one test method with
the following name:
[MethodName]_[StateUnderTest]_[ExpectedBehavior]
.
Example 1
SimpleParserCustomTests
Unit testing framework - MsTest
• Automates unit testing;
• Provides an intuitive easy to use interface;
• Generates output that can be used by the
continuous integration process;
• to write a unit test you just need to use
– two attributes [TestClass], [TestMethod];
– a static function call Assert that validates the test;
Example 1
SimpleParserTests
Unit testing classes that have
dependencies
Example 2
LegacyLogAnalyser
• Requirements:
– create a class that analyses a log file;
– if the log file is invalid call a webservice and log
the problem;
– if an error is encountered send an email to an
administrator;
Controlling dependencies
• identify dependencies;
• isolate them by introducing interfaces;
• this process is referred to as making the class
under test testable;
• during test replace interfaces with objects
that you can control(replace the dependency
with a fake);
• this process is referred to as mocking the
dependencies;
Example 2
LogAnalyser
LogAnalyserTests
Mocking framework – Rhino.Mocks
• a mocking framework facilitates the generation
of fakes;
• there are two main types of unit testing;
– state-based unit testing;
– interaction-based unit testing;
• there are two type of fakes to match the two
types of unit testing: stub and mock;
• Rhino.Mocks is the most widely used open
source framework;
• MockReposity.GenerateStub<T> and
MockReposity.GenerateMock<T> are the
methods used to generate fakes;
Example 2
LogAnalyserTestsWithRhinoMocks
Conclusion
• Defined the place of unit testing in the wider
context of software testing;
• Defined properties of a good unit test;
• Introduction to an unit testing framework;
• Discussed about the need to isolate and
control dependencies during testing;
• Introduction to a mocking framework.

More Related Content

What's hot (20)

PDF
Project Management: Burn-Down Chart / OrangeHRM Project MOD (eng)
Anatoliy Okhotnikov
 
PPTX
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
PPTX
Automation test scripting techniques
Zhu Zhong
 
PDF
Why Test Automation Fails
Ranorex
 
KEY
Best practices for writing good automated tests
Felipe Lima
 
PPT
Automation testing IBM RFT - Rational Functional Tester
VijayChowthri Nagaprakasham
 
PDF
Creating Maintainable Automated Acceptance Tests
Jez Humble
 
PDF
Testing automation in agile environment
Perfecto Mobile
 
PPTX
Framework for Web Automation Testing
Taras Lytvyn
 
PPT
Test automation in agile ecosystem
JohnRizer
 
PDF
Agile testing - Principles and best practices
Dr Ganesh Iyer
 
PPT
Automated Testing with Agile
Ken McCorkell
 
PDF
Introduction to Software Test Automation
Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)
 
PPT
Centralized test automation framework implementation
Bharathi Krishnamurthi
 
PDF
Testing Tools
Ted Husted
 
PDF
Automated vs manual testing
Kanoah
 
PPTX
Testing strategy for agile projects updated
Tharinda Liyanage
 
PDF
Tutorial ranorex
radikalzen
 
PDF
TEST_AUTOMATION_CASE_STUDY_(2)2[1]
Clive Dall
 
PDF
Introduction to Back End Automation Testing - Nguyen Vu Hoang, Hoang Phi
Ho Chi Minh City Software Testing Club
 
Project Management: Burn-Down Chart / OrangeHRM Project MOD (eng)
Anatoliy Okhotnikov
 
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
Automation test scripting techniques
Zhu Zhong
 
Why Test Automation Fails
Ranorex
 
Best practices for writing good automated tests
Felipe Lima
 
Automation testing IBM RFT - Rational Functional Tester
VijayChowthri Nagaprakasham
 
Creating Maintainable Automated Acceptance Tests
Jez Humble
 
Testing automation in agile environment
Perfecto Mobile
 
Framework for Web Automation Testing
Taras Lytvyn
 
Test automation in agile ecosystem
JohnRizer
 
Agile testing - Principles and best practices
Dr Ganesh Iyer
 
Automated Testing with Agile
Ken McCorkell
 
Introduction to Software Test Automation
Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)
 
Centralized test automation framework implementation
Bharathi Krishnamurthi
 
Testing Tools
Ted Husted
 
Automated vs manual testing
Kanoah
 
Testing strategy for agile projects updated
Tharinda Liyanage
 
Tutorial ranorex
radikalzen
 
TEST_AUTOMATION_CASE_STUDY_(2)2[1]
Clive Dall
 
Introduction to Back End Automation Testing - Nguyen Vu Hoang, Hoang Phi
Ho Chi Minh City Software Testing Club
 

Viewers also liked (6)

PPTX
Software testing
Ahmed Moawad
 
PPT
Software testing
Nitish Upreti
 
PPTX
Selenium Tutorial for Beginners | Automation framework Basics
Techcanvass
 
DOCX
Interview questions
swatiba
 
PPT
Types of Software Testing
Nishant Worah
 
DOC
Manual testing interview question by INFOTECH
Pravinsinh
 
Software testing
Ahmed Moawad
 
Software testing
Nitish Upreti
 
Selenium Tutorial for Beginners | Automation framework Basics
Techcanvass
 
Interview questions
swatiba
 
Types of Software Testing
Nishant Worah
 
Manual testing interview question by INFOTECH
Pravinsinh
 
Ad

Similar to Automated testing overview (20)

PPTX
Unit Testing and TDD 2017
Xavi Hidalgo
 
PPTX
Testing 101
Noam Barkai
 
PDF
Introduction to Automated Testing
Lars Thorup
 
PDF
Introduction to-automated-testing
BestBrains
 
PDF
Unit testing - An introduction
Alejandro Claro Mosqueda
 
PPTX
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
PPTX
Unit testing & TDD concepts with best practice guidelines.
Mohamed Taman
 
PPT
Paper PsUpload
techweb08
 
PPT
Paper Ps
techweb08
 
PPT
Paper Ps
techweb08
 
PPT
Paper Ps
techweb08
 
PPT
Paper CS
techweb08
 
PPT
alkatest7
techweb08
 
PPT
justin presentation upload PPT june 19
techweb08
 
PPT
justin presentation Slideshare PPT upload June 25 Final one
techweb08
 
PPT
Justin Presentation PPT Upload June 25 adv
techweb08
 
PPT
justin for ppt1 by browse button
techweb08
 
PPT
alka ppt upload no code change
techweb08
 
PPT
upload ppt1 by browse button
techweb08
 
PPT
alka ppt test from13
techweb08
 
Unit Testing and TDD 2017
Xavi Hidalgo
 
Testing 101
Noam Barkai
 
Introduction to Automated Testing
Lars Thorup
 
Introduction to-automated-testing
BestBrains
 
Unit testing - An introduction
Alejandro Claro Mosqueda
 
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
Unit testing & TDD concepts with best practice guidelines.
Mohamed Taman
 
Paper PsUpload
techweb08
 
Paper Ps
techweb08
 
Paper Ps
techweb08
 
Paper Ps
techweb08
 
Paper CS
techweb08
 
alkatest7
techweb08
 
justin presentation upload PPT june 19
techweb08
 
justin presentation Slideshare PPT upload June 25 Final one
techweb08
 
Justin Presentation PPT Upload June 25 adv
techweb08
 
justin for ppt1 by browse button
techweb08
 
alka ppt upload no code change
techweb08
 
upload ppt1 by browse button
techweb08
 
alka ppt test from13
techweb08
 
Ad

Recently uploaded (20)

PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 

Automated testing overview

  • 2. Summary • Why do we need software testing • Software testing definition • Types of testing • Why do we need automated testing • Unit testing for simple objects • Unit testing for objects that have dependencies • Automated testing for user interface
  • 3. Why do we need software testing • To reduce operating costs : software bugs are a big cost for the business; • To protect company reputation : software quality is a key requirement of any new project; • any developer will do some kind of testing before delivering the software to the client; • software testing is a core activity associated with the development process;
  • 4. Software testing definition • Definition: Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test; • software testing verifies and validates that the software deliverable: – meets the business and technical requirements that guided its design and development; – works as expected;
  • 5. Types of testing • system testing : exercises the application end to end. Based on specifications and executed using tests scripts as part of a test plan. • integration testing : targets parts of the application e.g. the service layer; • unit testing : tests individual code units : e.g. classes.
  • 6. Cost of software bugs Cost to fix a defect Time detected Requirem ents Architectu re Constructi on System test After release Time introd uced Requirement s 1x 3x 5-10x 10x 10-100x Architecture - 1x 10x 15x 25-100x Construction - - 1x 10x 10-25x • the cost of removing a software bug is linked to the development stage the software bug is found;
  • 7. Difficulties of software testing • It is a lengthy process and can happen only after the alpha stage of the application; • Constant retesting : After each release we need to test new features and retest existing ones - even if the changes affect only a part of the application we can never be sure that the rest of the application is unaffected; • Usually the full test plan is applied right at the end of the delivery cycle : regression errors or unexpected errors can be detected too close to final delivery - they can affect the delivery schedule;
  • 8. Solution: automated tests • Automate the test plan right from the beginning of the development cycle : the developer can now exercise the application before is deployed to testing; • System testing will always have a manual part but can be also comprised of automated tests that can cover a lot of scenarios • Use unit testing and integration testing extensively as they can be automated with minimal costs;
  • 9. Why do we need automated testing • TIME - speed up the delivery schedule : the test window is reduced and testers can concentrate more on exploratory testing and test cases that cannot be automated; • COST - reduce the number of bugs : bugs can be detected before a deployment is made and regression issues are reduced significantly; • SCOPE - reduce the amount of rework and make scope changes cheap: the testers, business analysts and developers will start from test scenarios first that will increase the product knowledge right from the start;
  • 10. How to implement automated tests • The application need to be testable; • System testing : coded ui tests using an automation framework or using record and replay tools; • Integrations tests : inject data that is used to exercise the application layers for specific scenarios; • Unit testing : they are code only tests so they don’t have an impact on external systems and their dependencies
  • 12. What is a unit test • Can I run and get results from a unit test I wrote two weeks or even months or years ago? • Can any member of my team run and get the results from unit tests I wrote two months ago? • Can I run all the unit tests I’ve written in no more than a few minutes? • Can I run all the unit tests I’ve written at the push of a button? • Can I write a basic unit test in no more than a few minutes?
  • 13. Properties of a good unit test • It should be automated and repeatable. • It should be easy to implement. • Once it’s written, it should remain for future use. • Anyone should be able to run it. • It should run at the push of a button. • It should run quickly.
  • 14. Styles of writing unit tests • write production code first then unit tests; • test driven development(TDD): write the unit tests first then production code; • behaviour driven development(BDD): start from user stories and decompose them in scenarios then write code to validate the scenarios
  • 15. Unit testing naming conventions used in examples Object to be tested Object to create on the testing side Project Create a test project named [ProjectUnderTest].Tests. Class For each class, create at least one class with the name [ClassName]Tests. Method For each method, create at least one test method with the following name: [MethodName]_[StateUnderTest]_[ExpectedBehavior] .
  • 17. Unit testing framework - MsTest • Automates unit testing; • Provides an intuitive easy to use interface; • Generates output that can be used by the continuous integration process; • to write a unit test you just need to use – two attributes [TestClass], [TestMethod]; – a static function call Assert that validates the test;
  • 19. Unit testing classes that have dependencies
  • 20. Example 2 LegacyLogAnalyser • Requirements: – create a class that analyses a log file; – if the log file is invalid call a webservice and log the problem; – if an error is encountered send an email to an administrator;
  • 21. Controlling dependencies • identify dependencies; • isolate them by introducing interfaces; • this process is referred to as making the class under test testable; • during test replace interfaces with objects that you can control(replace the dependency with a fake); • this process is referred to as mocking the dependencies;
  • 23. Mocking framework – Rhino.Mocks • a mocking framework facilitates the generation of fakes; • there are two main types of unit testing; – state-based unit testing; – interaction-based unit testing; • there are two type of fakes to match the two types of unit testing: stub and mock; • Rhino.Mocks is the most widely used open source framework; • MockReposity.GenerateStub<T> and MockReposity.GenerateMock<T> are the methods used to generate fakes;
  • 25. Conclusion • Defined the place of unit testing in the wider context of software testing; • Defined properties of a good unit test; • Introduction to an unit testing framework; • Discussed about the need to isolate and control dependencies during testing; • Introduction to a mocking framework.

Editor's Notes

  • #5: Depending on the type of industry software testing has a different importance but in the last decade the quality of the software has increased dramatically while the delivery cycle was reduced considerably; At Microsoft a team of 20 developers will have a team of 20 testers;
  • #6: types of testing based on the testing method: black box testing: a method that tests the functionality of an application as opposed to its internal structures or workings. Test cases are built around specifications and requirements; white box testing: a method that tests internal structures or workings of an application as opposed to its functionality. The tester chooses inputs to exercise paths through the code and determine the appropriate output. types of testing based on the level of specificity: system testing: tests a completely integrated system to verify that it meets its requirements. UI software testing Usability testing Performance testing Compatibility testing Regression testin g integration testing: verifies the interfaces between components against a software design. Testing two or more dependent software modules as a group. unit testing: verifies the functionality of a specific section of code, usually at the function level. In an object-oriented environment, this is usually at the class level.
  • #7: McConnell, Steve (2004). Code Complete 2nd Ed ) bugs introduced in construction are costly to be fixed;
  • #13: Revised definition: A unit test is an automated piece of code that invokes the method or class being tested and then checks some assumptions about the logical behavior of that method or class. A unit test is almost always written using a unit-testing framework. It can be written easily and runs quickly. It’s fully automated, trustworthy, readable, and maintainable.
  • #15: Waterfall vs agile development; BDD: If all scenarios associated with a user story are successfully validated we can say that the user story has met the acceptance criteria.
  • #22: An external dependency is an object in your system that your code under test interacts with, and over which you have no control. (Common examples are filesystems, threads, memory, time, and so on.) A stub is a controllable replacement for an existing dependency (or collaborator) in the system. By using a stub, you can test your code without dealing with the dependency directly.
  • #24: S tate-based testing (also called state verification) determines whether the exercised method worked correctly by examining the state of the system under test and its collaborators (dependencies) after the method is exercised. Interaction testing is testing how an object sends input to or receives input from other objects—how that object interacts with other objects. ( action-driven testing)