SlideShare a Scribd company logo
1 of 28
Download to read offline
Software Testing
An introduction and panorama
Roberto Casadei, PhD
{roby.casadei}@unibo.it
Alma Mater Studiorum - Università di Bologna
Dipartimento di Informatica - Scienza e Ingegneria
July 30, 2020
Laboratory of Software Systems
Outline
1 Introduction
2 Panorama
3 xUnit, TDD
4 Pointers
5 Wrap-up
Error vs. failure vs. fault
Failure (problem, anomaly): difference from expected result (e.g., wrt to specs)
Fault (defect, bug): cause of a failure; manifestation of an error
A failure may be caused by many faults
A fault can cause many failures.
Error (mistake): mistake which caused the faults to occur
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 1/22
Testing and V&V
Testing: activity looking for failures, revealing faults
Testing reveals the presence of faults, not their absence
Verification: checks system conformance with specifications
“Build the thing right”
“A design without specifications cannot be right or wrong, it can only be surprising!”
Validation: does the system meet stakeholder expectations?
“Build the right thing” (i.e., what is valuable)
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 2/22
Definitions of “software testing”
1) “An investigation conducted to provide stakeholders with information about
the quality of the software product or service under test” (Cem Kaner/Wikipedia)
2) “Activity in which a system or component is executed under specified
conditions, the results are observed or recorded, and an evaluation is made
of some aspect of the system or component” (ISO/IEC/IEEE 24765:2010
Systems and software engineering – Vocabulary)
3) “The process consisting of all lifecycle activities, both static and dynamic,
concerned with planning, preparation and evaluation of software products
and related work products to determine that they satisfy specified
requirements, to demonstrate that they are fit for purpose and to detect
defects.” (ISTQB–International Software Testing Qualifications Board)
4) “The overall process of planning, preparing, and carrying out a suite of
different types of tests designed to validate a system under development, in
order to achieve an acceptable level of quality and to avoid unacceptable
risks”
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 3/22
Definitions of “software testing”
1) “An investigation conducted to provide stakeholders with information about
the quality of the software product or service under test” (Cem Kaner/Wikipedia)
2) “Activity in which a system or component is executed under specified
conditions, the results are observed or recorded, and an evaluation is made
of some aspect of the system or component” (ISO/IEC/IEEE 24765:2010
Systems and software engineering – Vocabulary)
3) “The process consisting of all lifecycle activities, both static and dynamic,
concerned with planning, preparation and evaluation of software products
and related work products to determine that they satisfy specified
requirements, to demonstrate that they are fit for purpose and to detect
defects.” (ISTQB–International Software Testing Qualifications Board)
4) “The overall process of planning, preparing, and carrying out a suite of
different types of tests designed to validate a system under development, in
order to achieve an acceptable level of quality and to avoid unacceptable
risks”
→ activity/process; variety; v&v; quality; risk
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 3/22
Standards for software testing
IEEE Std 1044-1 Classification for Software Anomalies
IEEE Std 829-2008 Software Test Documentation — superseded by 29119-3
ISO/IEC/IEEE 29119: Software and systems engineering – Software testing
− 29119-1:2013 Concepts and Definitions
− 29119-2:2013 Test processes
− 29119-3:2013 Test documentation
− 29119-4:2015 Test techniques
Specification-based test design techniques
Structure-based test design techniques
Experience-based test design techniques
− 29119-5:2016 Keyword-driven testing
29119 is controverse! due to (1) lack of true consensus; (2) heavy focus on
docs; (3) theory vs. practice inconsistencies; (4) exclusion of context-driven
testing; (5) too prescriptive; (6) political and monetary connotations
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 4/22
Testing: what it is all about1
Why you test
I.e., what is the goal?
What to test
Subject/System Under Test (SUT); functional & non-functional requirements
Who prepares tests, run tests, evaluates results, etc.
and relationships with other stakeholders (e.g., developers, customers)
When tests are prepared, executed
w.r.t. when the SUT is designed, implemented, validated, and released?
How testing is done
I.e., what techniques, tools, processes etc.?
1
Cf., Six Honest Serving Men (Rudyard Kipling)
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 5/22
Perspectives on testing
“Schools” of testing
Analytic School: testing as a rigorous task, via formal methods
Motto: Programs are logical artifacts, subject to math laws
Factory School: testing to measure project progress
Motto: Testing must be planned/scheduled/managed
Quality School: testing as a quality process
Motto: A quality process for a quality product
Context-Driven School: testing as a stakeholder-oriented, adaptable process
Key question: which testing would be more valuable right now?
Agile School: testing to facilitate change
Techniques: test automation, test-driven approaches
Takeaway: perspectives on testing impact the why/what/how.. of testing
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 6/22
Testing: why
Testing is the widest industrial approach to V&V
Why doing testing
Testing as a key means for
1) quality
2) project risk mitigation
3) (long-term) productivity
4) specification/documentation
Why exploring testing
Powerful tool in any software engineer’s toolbox
Career paths
Intensively researched topic
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 7/22
Outline
1 Introduction
2 Panorama
3 xUnit, TDD
4 Pointers
5 Wrap-up
Many different kinds of testing (what, how, when)
Multiple dimensions
Technology-facing vs. Business-facing testing
Verification vs. validation; component vs. usability testing
Granularity/scope of testing
Unit – integration – system-level/end-to-end/acceptance
Static vs. dynamic
Code-level vs. runtime
Manual (human-based) vs. automated (computer-based)
Examples of human testing: inspection (code reviews), walkthrough
Examples of computer-based testing: static analysis, “standard” testing
Structural (aka white-box) vs. functional (aka black-box)
Examples of structural testing: control flow testing, path testing
Examples of functional testing: equivalence partitioning, BVA
Frequency, whether planned or not, temporal scope..
Waterfall vs. shift-left; build/manually/change-triggered
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 8/22
V&V techniques by static/dynamic × manual/automated
Human Computer
Static Inspection, technical reviews Static analysis
Dynamic Walkthrough, usability testing Testing
Note: terminology is sometimes inconsistent or ambiguous.
What precisely is “testing” and what “V&V” and what “analysis” depend on
definitions, hence to where lines are drawn.
For sure: testing includes both V&V techniques
For sure: V&V include testing techniques
Often, testing is considered only as a dynamic activity
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 9/22
Levels of testing
Levels of testing based on granularity/scope
1) Unit testing: testing at the level of individual units (of functionality)
2) Integration testing: testing of the functionality provided by multiple
integrated/interacting units
3) System testing: testing the whole system for correctness
In a black-box way
Non-functional requirements (e.g., efficiency, reliability, security) are typically tested
at this level
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 10/22
Acceptance tests
Acceptance testing: testing the whole system against the needs and
expectations of users and stakeholders
Acceptance testing
Is the SW system “acceptable” (for delivery)?
It’s about testing whether the SW system satisfies the acceptance criteria (e.g.,
as specified in the requirements)
Acceptability is matter of customers, product owners, or users
It is very much about what has to be built
⇒ Acceptance test-driven development (ATDD)
Tools: FitNesse (wiki-based), JBehave, Cucumber
Acceptance testing vs. system testing
System tests ⇒ build the thing right (things should behave correctly)
Acceptance tests ⇒ build the right thing (validate what you want)
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 11/22
Outline
1 Introduction
2 Panorama
3 xUnit, TDD
4 Pointers
5 Wrap-up
jUnit
public class DeviceImplTest {
private DeviceImpl device;
@Before public void init(){
this.device = new DeviceImpl(); // Arrange
}
@Test public void on() throws Exception {
this.device.on(); // Act
assertTrue(this.device.isOn()); // Assert
}
}
Concepts
Test suite (1+ test classes), test cases (test methods)
Assertions
Fixture
Arrange–Act–Assert
Test automation, Test execution, Test lifecycle, Test reporting
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 12/22
Code Coverage
Coverage
Various definitions/metrics
Many “things” can be “covered” (statements, decisions, paths...)
Code coverage: which/how much code is executed during testing
Mainly used for finding untested codea
Note: 100% coverage doesn’t mean that tests cover all the scenarios
The goal is not 100% coverage → testing the “right things”
a
https://martinfowler.com/bliki/TestCoverage.html
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 13/22
Test-Driven Development (TDD)
What
“Development” is guided (“driven”) by “tests”
I.e., it is not “really” a testing activity; tests as (useful) side-effect
Exercise your code before even writing it
Makes you explore the problem before attempting a solution
Forces you to think as the user of your code
Makes you focus on what is important right now (cf., KISS)
Red – Green – Refactor cycle
Benefits
Specification before implementation
Guides the (detailed) design process
You end up with regression tests (i.e., tests to catch regressions)
A regression is when something correct gets broken
A safety net against regressions is fundamental for refactoring activities
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 14/22
TDD: Outside-In Development
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 15/22
Outline
1 Introduction
2 Panorama
3 xUnit, TDD
4 Pointers
5 Wrap-up
Testing and Software Development / Project Lifecycle
Testing and Agile
Continuous testing: automatically, frequently run tests in background upon
source file changes
By shortening the mistake-to-failure time, it is easier to trace faults
Testing and CI/CD
Use test results as barriers for build processes, merges, and releases
Produce reports (e.g., coverage...) and keep track of project health
Issue tracking and debugging
Testing and production/deployment
A/B testing: testing two versions of the same SW (e.g., by splitting users)
… often combined with Blue/Green deployment
Canary releases: canary traffic to test candidate releases before promoting ’em
Chaos engineering: inject errors in production to anticipate problems
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 16/22
More testing techniques and practice (1/2)
Effective testing
Good tests are: readable, maintainable, trustworthy
Good code is testable code (modularity, SOLID, dependency injection)
Test doubles
Replace real impls for: isolation, speedup, determinism, observation&control
dummies, stubs, fake objects, test spies, mocks
Testing techniques
Exploratory testing (ad-hoc testing)
Test-case construction: Decision tables, Equivalence partitioning, BVA, ..
Property-based testing, metamorphic testing
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 17/22
More testing techniques and practice (2/2)
Behaviour-Driven Development (BDD)
BDD ≈ ATDD + customer-orientation
collaborative specification of acceptance tests, working as executable specs
and living documentation, fostering an ubiquitous language (cf. DDD)
Cf., Cucumber
Testing tools
Testing frameworks for automation, execution, reporting
Testing libraries for mocking and specific testing techniques
Testing DSLs (cf. ScalaTest) and consequences in readability and reporting
More tools: issue tracking, mutation testing, ...
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 18/22
Testing everything (1/2)
Testing web applications
MVC testing (frameworks – Rails, Spring... – generally provide some support)
Selenium: tool that provides support for browser-based tests
Test-driven DB development
Leverage concept of migration (document each DB change, checkout DB
version by running the sequence of changes)
Testing GUIs
Test monkey + logging
Mouse/Keyboard capture + replay tools + scripts
Programmatic access to GUI
Image recognition (e.g., SikuliX)
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 19/22
Testing everything (2/2)
Testing distributed systems
Microservice testing (cf., Mountebank, Spring Boot Test)
Distributed tracing, monitoring, logging (cf., Zipkin)
Multi JVM/node testing (cf., Akka TestKit)
Inject failures and stress (cf. Netflix’s Sirmian Army, ChaosToolkit)
And more...
Load/stress testing (cf. Gatling, ApacheBench...)
Microbenchmarking (cf. ScalaMeter...)
...
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 20/22
Outline
1 Introduction
2 Panorama
3 xUnit, TDD
4 Pointers
5 Wrap-up
Concluding Remarks
Testing is a process looking for failures to reveal faults and provide information
to stakeholders
Testing is key for
1) driving design
2) fostering quality
3) collaborative specification
4) documentation
5) (long-term) productivity
The panorama of testing is highly variegated
R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 21/22

More Related Content

What's hot

Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testing
nazeer pasha
 
201008 Software Testing Notes (part 1/2)
201008 Software Testing Notes (part 1/2)201008 Software Testing Notes (part 1/2)
201008 Software Testing Notes (part 1/2)
Javier Gonzalez-Sanchez
 
FDA Expectations for Traceability in Device & Diagnostic Design
FDA Expectations for Traceability in Device & Diagnostic DesignFDA Expectations for Traceability in Device & Diagnostic Design
FDA Expectations for Traceability in Device & Diagnostic Design
Seapine Software
 

What's hot (19)

stlc
stlcstlc
stlc
 
ISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture NotesISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture Notes
 
Qa Faqs
Qa FaqsQa Faqs
Qa Faqs
 
Exploratory Testing Explained
Exploratory Testing ExplainedExploratory Testing Explained
Exploratory Testing Explained
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testing
 
201008 Software Testing Notes (part 1/2)
201008 Software Testing Notes (part 1/2)201008 Software Testing Notes (part 1/2)
201008 Software Testing Notes (part 1/2)
 
Istqb ctfl syll 2011
Istqb ctfl syll 2011Istqb ctfl syll 2011
Istqb ctfl syll 2011
 
Ôn tập kiến thức ISTQB
Ôn tập kiến thức ISTQBÔn tập kiến thức ISTQB
Ôn tập kiến thức ISTQB
 
TEA Presentation V 0.3
TEA Presentation V 0.3TEA Presentation V 0.3
TEA Presentation V 0.3
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
CTFL chapter 06
CTFL chapter 06CTFL chapter 06
CTFL chapter 06
 
Chapter 13 An evaluation framework
Chapter 13 An evaluation frameworkChapter 13 An evaluation framework
Chapter 13 An evaluation framework
 
QUality Assessment of System Architectures and their Requirements (QUASAR)
QUality Assessment of System Architectures and their Requirements (QUASAR)QUality Assessment of System Architectures and their Requirements (QUASAR)
QUality Assessment of System Architectures and their Requirements (QUASAR)
 
Importance of Testing in SDLC
Importance of Testing in SDLCImportance of Testing in SDLC
Importance of Testing in SDLC
 
FDA Expectations for Traceability in Device & Diagnostic Design
FDA Expectations for Traceability in Device & Diagnostic DesignFDA Expectations for Traceability in Device & Diagnostic Design
FDA Expectations for Traceability in Device & Diagnostic Design
 
Chapter Three Static Techniques
Chapter Three Static TechniquesChapter Three Static Techniques
Chapter Three Static Techniques
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
 
QA Interview Questions With Answers
QA Interview Questions With AnswersQA Interview Questions With Answers
QA Interview Questions With Answers
 

Similar to Testing: an Introduction and Panorama

Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3
Jenny Nguyen
 
Aim (A).pptx
Aim (A).pptxAim (A).pptx
Aim (A).pptx
14941
 
ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2
Yogindernath Gupta
 
ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1
Yogindernath Gupta
 

Similar to Testing: an Introduction and Panorama (20)

Gcs day1
Gcs day1Gcs day1
Gcs day1
 
Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3
 
Manual Testing Interview Questions & Answers.docx
Manual Testing Interview Questions & Answers.docxManual Testing Interview Questions & Answers.docx
Manual Testing Interview Questions & Answers.docx
 
Performance testing reference model
Performance testing reference modelPerformance testing reference model
Performance testing reference model
 
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
 
Comp8 unit10 lecture_slides
Comp8 unit10 lecture_slidesComp8 unit10 lecture_slides
Comp8 unit10 lecture_slides
 
Stlc phases.
Stlc phases.Stlc phases.
Stlc phases.
 
Role+Of+Testing+In+Sdlc
Role+Of+Testing+In+SdlcRole+Of+Testing+In+Sdlc
Role+Of+Testing+In+Sdlc
 
Testing Interview Questions.pdf
Testing Interview Questions.pdfTesting Interview Questions.pdf
Testing Interview Questions.pdf
 
Software testing
Software testingSoftware testing
Software testing
 
Software testing
Software testingSoftware testing
Software testing
 
Testing Throughout the Software Life Cycle - Section 2
Testing Throughout the Software Life Cycle - Section 2Testing Throughout the Software Life Cycle - Section 2
Testing Throughout the Software Life Cycle - Section 2
 
Aim (A).pptx
Aim (A).pptxAim (A).pptx
Aim (A).pptx
 
Risk Driven Testing
Risk Driven TestingRisk Driven Testing
Risk Driven Testing
 
ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2
 
ISTQBCH2.ppt
ISTQBCH2.pptISTQBCH2.ppt
ISTQBCH2.ppt
 
ISTQBCH2.ppt
ISTQBCH2.pptISTQBCH2.ppt
ISTQBCH2.ppt
 
ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1
 
Manual Testing Guide1.pdf
Manual Testing Guide1.pdfManual Testing Guide1.pdf
Manual Testing Guide1.pdf
 
Software test proposal
Software test proposalSoftware test proposal
Software test proposal
 

More from Roberto Casadei

Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Roberto Casadei
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Roberto Casadei
 
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Roberto Casadei
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Roberto Casadei
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Roberto Casadei
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
Roberto Casadei
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Roberto Casadei
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
Roberto Casadei
 

More from Roberto Casadei (20)

Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
 
A Presentation of My Research Activity
A Presentation of My Research ActivityA Presentation of My Research Activity
A Presentation of My Research Activity
 
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
 
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
 
Aggregate Computing Research: an Overview
Aggregate Computing Research: an OverviewAggregate Computing Research: an Overview
Aggregate Computing Research: an Overview
 
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
 
6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
 
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
 
Aggregate Processes in Field Calculus
Aggregate Processes in Field CalculusAggregate Processes in Field Calculus
Aggregate Processes in Field Calculus
 
AWS and Serverless Computing
AWS and Serverless ComputingAWS and Serverless Computing
AWS and Serverless Computing
 
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
 

Recently uploaded

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Recently uploaded (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 

Testing: an Introduction and Panorama

  • 1. Software Testing An introduction and panorama Roberto Casadei, PhD {roby.casadei}@unibo.it Alma Mater Studiorum - Università di Bologna Dipartimento di Informatica - Scienza e Ingegneria July 30, 2020 Laboratory of Software Systems
  • 2. Outline 1 Introduction 2 Panorama 3 xUnit, TDD 4 Pointers 5 Wrap-up
  • 3. Error vs. failure vs. fault Failure (problem, anomaly): difference from expected result (e.g., wrt to specs) Fault (defect, bug): cause of a failure; manifestation of an error A failure may be caused by many faults A fault can cause many failures. Error (mistake): mistake which caused the faults to occur R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 1/22
  • 4. Testing and V&V Testing: activity looking for failures, revealing faults Testing reveals the presence of faults, not their absence Verification: checks system conformance with specifications “Build the thing right” “A design without specifications cannot be right or wrong, it can only be surprising!” Validation: does the system meet stakeholder expectations? “Build the right thing” (i.e., what is valuable) R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 2/22
  • 5. Definitions of “software testing” 1) “An investigation conducted to provide stakeholders with information about the quality of the software product or service under test” (Cem Kaner/Wikipedia) 2) “Activity in which a system or component is executed under specified conditions, the results are observed or recorded, and an evaluation is made of some aspect of the system or component” (ISO/IEC/IEEE 24765:2010 Systems and software engineering – Vocabulary) 3) “The process consisting of all lifecycle activities, both static and dynamic, concerned with planning, preparation and evaluation of software products and related work products to determine that they satisfy specified requirements, to demonstrate that they are fit for purpose and to detect defects.” (ISTQB–International Software Testing Qualifications Board) 4) “The overall process of planning, preparing, and carrying out a suite of different types of tests designed to validate a system under development, in order to achieve an acceptable level of quality and to avoid unacceptable risks” R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 3/22
  • 6. Definitions of “software testing” 1) “An investigation conducted to provide stakeholders with information about the quality of the software product or service under test” (Cem Kaner/Wikipedia) 2) “Activity in which a system or component is executed under specified conditions, the results are observed or recorded, and an evaluation is made of some aspect of the system or component” (ISO/IEC/IEEE 24765:2010 Systems and software engineering – Vocabulary) 3) “The process consisting of all lifecycle activities, both static and dynamic, concerned with planning, preparation and evaluation of software products and related work products to determine that they satisfy specified requirements, to demonstrate that they are fit for purpose and to detect defects.” (ISTQB–International Software Testing Qualifications Board) 4) “The overall process of planning, preparing, and carrying out a suite of different types of tests designed to validate a system under development, in order to achieve an acceptable level of quality and to avoid unacceptable risks” → activity/process; variety; v&v; quality; risk R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 3/22
  • 7. Standards for software testing IEEE Std 1044-1 Classification for Software Anomalies IEEE Std 829-2008 Software Test Documentation — superseded by 29119-3 ISO/IEC/IEEE 29119: Software and systems engineering – Software testing − 29119-1:2013 Concepts and Definitions − 29119-2:2013 Test processes − 29119-3:2013 Test documentation − 29119-4:2015 Test techniques Specification-based test design techniques Structure-based test design techniques Experience-based test design techniques − 29119-5:2016 Keyword-driven testing 29119 is controverse! due to (1) lack of true consensus; (2) heavy focus on docs; (3) theory vs. practice inconsistencies; (4) exclusion of context-driven testing; (5) too prescriptive; (6) political and monetary connotations R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 4/22
  • 8. Testing: what it is all about1 Why you test I.e., what is the goal? What to test Subject/System Under Test (SUT); functional & non-functional requirements Who prepares tests, run tests, evaluates results, etc. and relationships with other stakeholders (e.g., developers, customers) When tests are prepared, executed w.r.t. when the SUT is designed, implemented, validated, and released? How testing is done I.e., what techniques, tools, processes etc.? 1 Cf., Six Honest Serving Men (Rudyard Kipling) R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 5/22
  • 9. Perspectives on testing “Schools” of testing Analytic School: testing as a rigorous task, via formal methods Motto: Programs are logical artifacts, subject to math laws Factory School: testing to measure project progress Motto: Testing must be planned/scheduled/managed Quality School: testing as a quality process Motto: A quality process for a quality product Context-Driven School: testing as a stakeholder-oriented, adaptable process Key question: which testing would be more valuable right now? Agile School: testing to facilitate change Techniques: test automation, test-driven approaches Takeaway: perspectives on testing impact the why/what/how.. of testing R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 6/22
  • 10. Testing: why Testing is the widest industrial approach to V&V Why doing testing Testing as a key means for 1) quality 2) project risk mitigation 3) (long-term) productivity 4) specification/documentation Why exploring testing Powerful tool in any software engineer’s toolbox Career paths Intensively researched topic R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 7/22
  • 11. Outline 1 Introduction 2 Panorama 3 xUnit, TDD 4 Pointers 5 Wrap-up
  • 12. Many different kinds of testing (what, how, when) Multiple dimensions Technology-facing vs. Business-facing testing Verification vs. validation; component vs. usability testing Granularity/scope of testing Unit – integration – system-level/end-to-end/acceptance Static vs. dynamic Code-level vs. runtime Manual (human-based) vs. automated (computer-based) Examples of human testing: inspection (code reviews), walkthrough Examples of computer-based testing: static analysis, “standard” testing Structural (aka white-box) vs. functional (aka black-box) Examples of structural testing: control flow testing, path testing Examples of functional testing: equivalence partitioning, BVA Frequency, whether planned or not, temporal scope.. Waterfall vs. shift-left; build/manually/change-triggered R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 8/22
  • 13. V&V techniques by static/dynamic × manual/automated Human Computer Static Inspection, technical reviews Static analysis Dynamic Walkthrough, usability testing Testing Note: terminology is sometimes inconsistent or ambiguous. What precisely is “testing” and what “V&V” and what “analysis” depend on definitions, hence to where lines are drawn. For sure: testing includes both V&V techniques For sure: V&V include testing techniques Often, testing is considered only as a dynamic activity R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 9/22
  • 14. Levels of testing Levels of testing based on granularity/scope 1) Unit testing: testing at the level of individual units (of functionality) 2) Integration testing: testing of the functionality provided by multiple integrated/interacting units 3) System testing: testing the whole system for correctness In a black-box way Non-functional requirements (e.g., efficiency, reliability, security) are typically tested at this level R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 10/22
  • 15. Acceptance tests Acceptance testing: testing the whole system against the needs and expectations of users and stakeholders Acceptance testing Is the SW system “acceptable” (for delivery)? It’s about testing whether the SW system satisfies the acceptance criteria (e.g., as specified in the requirements) Acceptability is matter of customers, product owners, or users It is very much about what has to be built ⇒ Acceptance test-driven development (ATDD) Tools: FitNesse (wiki-based), JBehave, Cucumber Acceptance testing vs. system testing System tests ⇒ build the thing right (things should behave correctly) Acceptance tests ⇒ build the right thing (validate what you want) R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 11/22
  • 16. Outline 1 Introduction 2 Panorama 3 xUnit, TDD 4 Pointers 5 Wrap-up
  • 17. jUnit public class DeviceImplTest { private DeviceImpl device; @Before public void init(){ this.device = new DeviceImpl(); // Arrange } @Test public void on() throws Exception { this.device.on(); // Act assertTrue(this.device.isOn()); // Assert } } Concepts Test suite (1+ test classes), test cases (test methods) Assertions Fixture Arrange–Act–Assert Test automation, Test execution, Test lifecycle, Test reporting R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 12/22
  • 18. Code Coverage Coverage Various definitions/metrics Many “things” can be “covered” (statements, decisions, paths...) Code coverage: which/how much code is executed during testing Mainly used for finding untested codea Note: 100% coverage doesn’t mean that tests cover all the scenarios The goal is not 100% coverage → testing the “right things” a https://martinfowler.com/bliki/TestCoverage.html R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 13/22
  • 19. Test-Driven Development (TDD) What “Development” is guided (“driven”) by “tests” I.e., it is not “really” a testing activity; tests as (useful) side-effect Exercise your code before even writing it Makes you explore the problem before attempting a solution Forces you to think as the user of your code Makes you focus on what is important right now (cf., KISS) Red – Green – Refactor cycle Benefits Specification before implementation Guides the (detailed) design process You end up with regression tests (i.e., tests to catch regressions) A regression is when something correct gets broken A safety net against regressions is fundamental for refactoring activities R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 14/22
  • 20. TDD: Outside-In Development R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 15/22
  • 21. Outline 1 Introduction 2 Panorama 3 xUnit, TDD 4 Pointers 5 Wrap-up
  • 22. Testing and Software Development / Project Lifecycle Testing and Agile Continuous testing: automatically, frequently run tests in background upon source file changes By shortening the mistake-to-failure time, it is easier to trace faults Testing and CI/CD Use test results as barriers for build processes, merges, and releases Produce reports (e.g., coverage...) and keep track of project health Issue tracking and debugging Testing and production/deployment A/B testing: testing two versions of the same SW (e.g., by splitting users) … often combined with Blue/Green deployment Canary releases: canary traffic to test candidate releases before promoting ’em Chaos engineering: inject errors in production to anticipate problems R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 16/22
  • 23. More testing techniques and practice (1/2) Effective testing Good tests are: readable, maintainable, trustworthy Good code is testable code (modularity, SOLID, dependency injection) Test doubles Replace real impls for: isolation, speedup, determinism, observation&control dummies, stubs, fake objects, test spies, mocks Testing techniques Exploratory testing (ad-hoc testing) Test-case construction: Decision tables, Equivalence partitioning, BVA, .. Property-based testing, metamorphic testing R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 17/22
  • 24. More testing techniques and practice (2/2) Behaviour-Driven Development (BDD) BDD ≈ ATDD + customer-orientation collaborative specification of acceptance tests, working as executable specs and living documentation, fostering an ubiquitous language (cf. DDD) Cf., Cucumber Testing tools Testing frameworks for automation, execution, reporting Testing libraries for mocking and specific testing techniques Testing DSLs (cf. ScalaTest) and consequences in readability and reporting More tools: issue tracking, mutation testing, ... R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 18/22
  • 25. Testing everything (1/2) Testing web applications MVC testing (frameworks – Rails, Spring... – generally provide some support) Selenium: tool that provides support for browser-based tests Test-driven DB development Leverage concept of migration (document each DB change, checkout DB version by running the sequence of changes) Testing GUIs Test monkey + logging Mouse/Keyboard capture + replay tools + scripts Programmatic access to GUI Image recognition (e.g., SikuliX) R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 19/22
  • 26. Testing everything (2/2) Testing distributed systems Microservice testing (cf., Mountebank, Spring Boot Test) Distributed tracing, monitoring, logging (cf., Zipkin) Multi JVM/node testing (cf., Akka TestKit) Inject failures and stress (cf. Netflix’s Sirmian Army, ChaosToolkit) And more... Load/stress testing (cf. Gatling, ApacheBench...) Microbenchmarking (cf. ScalaMeter...) ... R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 20/22
  • 27. Outline 1 Introduction 2 Panorama 3 xUnit, TDD 4 Pointers 5 Wrap-up
  • 28. Concluding Remarks Testing is a process looking for failures to reveal faults and provide information to stakeholders Testing is key for 1) driving design 2) fostering quality 3) collaborative specification 4) documentation 5) (long-term) productivity The panorama of testing is highly variegated R.Casadei Introduction Panorama xUnit, TDD Pointers Wrap-up 21/22