SlideShare a Scribd company logo
1 of 21
COMP23420 Sem 2 week 6
                        Software testing concepts
                                                     John Sargeant
                                                  johns@cs.man.ac.uk


                     REMINDER: PLEASE ENSURE THAT YOUR PHONE
                                 IS SWITCHED OFF

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Overview

•       Testing strategy
•       Practical issues
•       Safety critical systems
•       Basic testing techniques
•       Kinds of testing




C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
This software has bugs in…
Embury’s law: “This software has bugs in, we just don’t
  know what they are yet”.
Applies to any SW system of any size, e.g.
• Eurofighter fuel control system 80K lines
• Modern airliner ~10M lines
• ABC ~150K (our code) + ~300K (Java library code)

Also, unlike e.g. rostering, most real systems are
  concurrent and reactive not simple functions from
  inputs to outputs.

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Testing to fail
The fundamental rule of testing: a successful test is one
  which causes the software to fail.
Difficult for programmers to do with their own code – not
   the same as debugging.
• Traditional solution: have a separate testing team
        who are as nasty to the software as possible (see
        Software testing, Ron Patton, Sams 2006 for a guide to this approach).

• Agile solution – write the tests before the code – also
        helps to clarify requirements.


C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
How many bugs?
Traditional estimate is 3-5 per hundred lines of C code.
That’s 30,000 – 50,000 for a million line program!


• Of those ~90% will probably be found by routine
        debugging
• And ~90%of the rest by sensible testing
• And ~90% of the rest by really rigorous testing

But that still leaves 30-50, and getting to 99.9% is very
  expensive.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Factors affecting bug density
• Design – good designs lead to fewer bugs
• Type of application: concurrent, reactive systems are
        much more difficult than sequential transformation
        systems.
•       Programming language: Java < C < Perl
•       Programmer competence and experience
•       In general expect 1-10 bugs per hundred lines
•       (Probably a lot less for pair programming, but at a
        factor of 2 cost).

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
When you can’t afford 30-50 bugs
Major issue for safety critical systems, e.g. fly-by-wire.
• Conventional aircraft: pilot input directly controls flight
        surfaces (via hydraulics in large aircraft).
• FBW aircraft: a computer interprets the pilot’s inputs,
        and relays these electronically to the flight surfaces
• First used in the F16, 1974. Allows military aircraft to
        be inherently unstable, hence more manoeuvrable
        (also helps stealth).
• First civilian application Airbus A320, early 1980s.
        Provides protection and reduces pilot workoad.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Triple redundancy (1)
• Airbus claimed that the A320 FBW software was
        designed to fail no more than once in 109 flight hours.
        How could they possible claim that?
• Once in 104.5 (33K) hours might be plausible – but
        nowhere near enough.
• But add a second computer, with different software
        written by a different team. Now (in theory) both will
        fail at the same time once in 109 hours.
• But if there is a discrepancy you don’t know which
        one’s wrong – so you need a third computer and take
        a majority vote: triple redundancy.

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Triple redundancy (2)
Other advantages:
• Provides graceful degradation: don’t have to revert to
        manual control immediately with one computer out.
• Gives continuous testing for free – each discrepancy
        reveals a bug! So eventually the system should be
        extremely reliable – recent safety record of the A320
        is outstanding.
• Redundancy is essential to providing reasonable
        levels of safety in complex safety-critical systems.
• Note: the actual A320 system has a lot more
        redundancy than described above
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Quiz(1)

Suggest at least three reasons why the theoretical sum
  104.5 x 104.5 = 109 may not reflect what happens in
  practice. Hints:
• Is there still a single point of failure in the system?
• Remember: not all bugs are in the actual software
• When is it true that P(A and B) = P(A) x P(B)?



C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Exhaustive testing is impossible
public static double divide(double a, double b){
       return a / b;
}
 A Java double is 64 bits so there are 2128 possibilities –
   intractable.
Similarly a reactive system such as FBW has a huge
  number of possible (state, input, time) combinations.
So we have to find a large number of bugs within a
  huge search space – we have to focus effort on the
  most “interesting” parts of that space.

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Testing as a search problem
• Equivalence partitioning: split up the space into areas
        where similar tests are likely to lead to similar results
• e.g. if 2/3 works then 3/5 probably works too (but not
        necessarily 3/3
• Boundary value analysis: concentrate on boundaries
        between different parts of the space.
• E.g. b == 0, b very close to 0, a and/or b close to
        MAX_DOUBLE etc.



C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Black box or white box?
Black box: testing the software against its spec without
  access to the code:
• Means tests will be written without preconceptions
        about how the code works.
• If the code is changed, the same tests are still valid.
White box: testing with access to the code:
• Allows more tests to be done
• Allows tester to apply pressure to those places which
        look most likely to break.

C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Quiz(2)

2. You are testing an algorithm which sorts strings into
           alphanumeric order for a dictionary program.
           Suggest some of the most important tests you’ll
           need to do.
3. You are asked to thoroughly test floating point
           division software which will be burnt into a processor
           chip. Would you go about this primarily though black
           box or white box testing, and why?



C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Kinds of testing
• Unit testing – test one unit (in OO one class) at a
        time.
• Integration testing – test that the components of a
        system (or subsystem) work together correctly
• Regression/smoke testing – check that you haven’t
        broken it.
• System testing – test that the system works in the
        context in which it will be required to work.
• Alpha and beta testing – test with real users
• Acceptance testing – get the customer to come up
        with the dosh.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Unit testing
• Testing one unit – class - at a time.
• Relatively simple, but the class you’re testing will
        usually rely on other classes.
• In general almost all software relies on other software
        (e.g. Java library classes).
• The search space is generally well defined so
        techniques like EP ad BVA are most useful here.
• Often possible to be systematic and reasonably
        confident that a single class is bug-free.
• In Java, often done with the JUnit testing framework.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Integration testing
• Testing that the components of a system work
        together.
• Harder to define than unit testing; shape of testing
        space is less obvious.
• Concentrate on important mission-critical features
• Check that the use cases can be performed without
        problems.
• Don’t get upset when your code causes a problem;
        don’t get annoyed when somebody else’s does.


C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Regression/smoke testing

• Regression testing: repeat the tests you did before, to
        make sure you haven’t broken anything.
• Especially important after significant changes but the
        more often the better.
• Smoke testing: repeat the most critical tests as often
        as possible – check that it’s not going up in smoke.
• Integration and Regression/smoke testing are often
        done in the form of a daily (or nightly) “build” of the
        system – requires that at least some tests are
        automated.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
System testing
• Testing of the system in the context(s) in which it will
        operate.
• This will generally be a lot more varied than the
        context in which it was developed.
• May involve different hardware, operating systems,
        performance issues etc.
• Need to check the documentation and procedures as
        well as the code.
• Many systems which (seem to) work perfectly in a
        development environment fail in a customer
        environment.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Alpha and beta testing
• System testing with real users
• Important because they don’t use the software the
        way you assume.
• Alpha testing: a small group of users, done with SW
        developers present.
• Beta testing: a wider group, remote from the
        development team, asked to submit bug reports.
• Better not to start Beta testing until the software will
        work for most of the users most of the time!


C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r
Acceptance testing
Where a SW product has a small number of large
 customers (e.g. Campus Solutions) the customer(s)
 may specify a set of tests which the SW must pass
 before they will accept it and pay the dosh. There are
 some serious issues with this:
• In general, users don’t really know in advance what
        they want (the “waterfall fallacy”).
• Who within the customer organisation defines the
        spec? e.g. Managers and end users will have
        different views.
• Fixating on passing the acceptance test could result
        in serious problems being missed.
C om b ining th e s tre ngth s of U M IS T and
Th e Victoria U nive rs ity o f M anch e s te r

More Related Content

Viewers also liked

World Tennis Tournament Special 5 februari 2013
World Tennis Tournament Special 5 februari 2013World Tennis Tournament Special 5 februari 2013
World Tennis Tournament Special 5 februari 2013ABN AMRO
 
Retaillocaties in 2020
Retaillocaties in 2020Retaillocaties in 2020
Retaillocaties in 2020ABN AMRO
 
ABN AMRO zakenreisgids "zakendoen met Duitsland"
ABN AMRO zakenreisgids "zakendoen met Duitsland"ABN AMRO zakenreisgids "zakendoen met Duitsland"
ABN AMRO zakenreisgids "zakendoen met Duitsland"ABN AMRO
 
Visie op Sectoren Industrie 2011
Visie op Sectoren Industrie 2011Visie op Sectoren Industrie 2011
Visie op Sectoren Industrie 2011ABN AMRO
 
Sectorupdate pilotendesk Q2 2012
Sectorupdate pilotendesk Q2 2012Sectorupdate pilotendesk Q2 2012
Sectorupdate pilotendesk Q2 2012ABN AMRO
 
Visie op Sectoren Technologie, Media, Telecom 2012
 Visie op Sectoren Technologie, Media, Telecom 2012 Visie op Sectoren Technologie, Media, Telecom 2012
Visie op Sectoren Technologie, Media, Telecom 2012ABN AMRO
 
Fashionretail - ingrijpende effecten uitverkoop op modebranche
Fashionretail - ingrijpende effecten uitverkoop op modebrancheFashionretail - ingrijpende effecten uitverkoop op modebranche
Fashionretail - ingrijpende effecten uitverkoop op modebrancheABN AMRO
 

Viewers also liked (8)

Week7 unit-testing
Week7 unit-testingWeek7 unit-testing
Week7 unit-testing
 
World Tennis Tournament Special 5 februari 2013
World Tennis Tournament Special 5 februari 2013World Tennis Tournament Special 5 februari 2013
World Tennis Tournament Special 5 februari 2013
 
Retaillocaties in 2020
Retaillocaties in 2020Retaillocaties in 2020
Retaillocaties in 2020
 
ABN AMRO zakenreisgids "zakendoen met Duitsland"
ABN AMRO zakenreisgids "zakendoen met Duitsland"ABN AMRO zakenreisgids "zakendoen met Duitsland"
ABN AMRO zakenreisgids "zakendoen met Duitsland"
 
Visie op Sectoren Industrie 2011
Visie op Sectoren Industrie 2011Visie op Sectoren Industrie 2011
Visie op Sectoren Industrie 2011
 
Sectorupdate pilotendesk Q2 2012
Sectorupdate pilotendesk Q2 2012Sectorupdate pilotendesk Q2 2012
Sectorupdate pilotendesk Q2 2012
 
Visie op Sectoren Technologie, Media, Telecom 2012
 Visie op Sectoren Technologie, Media, Telecom 2012 Visie op Sectoren Technologie, Media, Telecom 2012
Visie op Sectoren Technologie, Media, Telecom 2012
 
Fashionretail - ingrijpende effecten uitverkoop op modebranche
Fashionretail - ingrijpende effecten uitverkoop op modebrancheFashionretail - ingrijpende effecten uitverkoop op modebranche
Fashionretail - ingrijpende effecten uitverkoop op modebranche
 

Similar to Week6 testing-intro

SE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingSE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingAmr E. Mohamed
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptxmianshafa
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software TestingHenry Muccini
 
On codes, machines, and environments: reflections and experiences
On codes, machines, and environments: reflections and experiencesOn codes, machines, and environments: reflections and experiences
On codes, machines, and environments: reflections and experiencesVincenzo De Florio
 
Test pattern Generation for 4:1 MUX
Test pattern Generation for 4:1 MUXTest pattern Generation for 4:1 MUX
Test pattern Generation for 4:1 MUXUrmilasSrinivasan
 
SE2018_Lec 19_ Software Testing
SE2018_Lec 19_ Software TestingSE2018_Lec 19_ Software Testing
SE2018_Lec 19_ Software TestingAmr E. Mohamed
 
Software Testing Foundations Part 5 - White Box Testing
Software Testing Foundations Part 5 - White Box TestingSoftware Testing Foundations Part 5 - White Box Testing
Software Testing Foundations Part 5 - White Box TestingNikita Knysh
 
Module5 Testing and Verification.pdf
Module5 Testing and Verification.pdfModule5 Testing and Verification.pdf
Module5 Testing and Verification.pdfBhavanaHN5
 
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing pptKedar Kumar
 
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...Lionel Briand
 
Introduzione allo Unit Testing
Introduzione allo Unit TestingIntroduzione allo Unit Testing
Introduzione allo Unit TestingStefano Ottaviani
 
Simote - easy iptv test automation
Simote - easy iptv test automationSimote - easy iptv test automation
Simote - easy iptv test automationSiim Puskai
 
Software testing
Software testingSoftware testing
Software testingBala Ganesh
 
Resilience and chaos engineering
Resilience and chaos engineeringResilience and chaos engineering
Resilience and chaos engineeringEric Wyles
 

Similar to Week6 testing-intro (20)

SE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingSE2_Lec 20_Software Testing
SE2_Lec 20_Software Testing
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptx
 
Testing
TestingTesting
Testing
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
 
On codes, machines, and environments: reflections and experiences
On codes, machines, and environments: reflections and experiencesOn codes, machines, and environments: reflections and experiences
On codes, machines, and environments: reflections and experiences
 
lect18.pdf
lect18.pdflect18.pdf
lect18.pdf
 
Test pattern Generation for 4:1 MUX
Test pattern Generation for 4:1 MUXTest pattern Generation for 4:1 MUX
Test pattern Generation for 4:1 MUX
 
overview.pdf
overview.pdfoverview.pdf
overview.pdf
 
SE2018_Lec 19_ Software Testing
SE2018_Lec 19_ Software TestingSE2018_Lec 19_ Software Testing
SE2018_Lec 19_ Software Testing
 
Software Testing Foundations Part 5 - White Box Testing
Software Testing Foundations Part 5 - White Box TestingSoftware Testing Foundations Part 5 - White Box Testing
Software Testing Foundations Part 5 - White Box Testing
 
TDD Training
TDD TrainingTDD Training
TDD Training
 
Module5 Testing and Verification.pdf
Module5 Testing and Verification.pdfModule5 Testing and Verification.pdf
Module5 Testing and Verification.pdf
 
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing ppt
 
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
 
Introduzione allo Unit Testing
Introduzione allo Unit TestingIntroduzione allo Unit Testing
Introduzione allo Unit Testing
 
Testing
TestingTesting
Testing
 
Simote - easy iptv test automation
Simote - easy iptv test automationSimote - easy iptv test automation
Simote - easy iptv test automation
 
Unit Testing a Primer
Unit Testing a PrimerUnit Testing a Primer
Unit Testing a Primer
 
Software testing
Software testingSoftware testing
Software testing
 
Resilience and chaos engineering
Resilience and chaos engineeringResilience and chaos engineering
Resilience and chaos engineering
 

Recently uploaded

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Week6 testing-intro

  • 1. COMP23420 Sem 2 week 6 Software testing concepts John Sargeant johns@cs.man.ac.uk REMINDER: PLEASE ENSURE THAT YOUR PHONE IS SWITCHED OFF C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 2. Overview • Testing strategy • Practical issues • Safety critical systems • Basic testing techniques • Kinds of testing C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 3. This software has bugs in… Embury’s law: “This software has bugs in, we just don’t know what they are yet”. Applies to any SW system of any size, e.g. • Eurofighter fuel control system 80K lines • Modern airliner ~10M lines • ABC ~150K (our code) + ~300K (Java library code) Also, unlike e.g. rostering, most real systems are concurrent and reactive not simple functions from inputs to outputs. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 4. Testing to fail The fundamental rule of testing: a successful test is one which causes the software to fail. Difficult for programmers to do with their own code – not the same as debugging. • Traditional solution: have a separate testing team who are as nasty to the software as possible (see Software testing, Ron Patton, Sams 2006 for a guide to this approach). • Agile solution – write the tests before the code – also helps to clarify requirements. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 5. How many bugs? Traditional estimate is 3-5 per hundred lines of C code. That’s 30,000 – 50,000 for a million line program! • Of those ~90% will probably be found by routine debugging • And ~90%of the rest by sensible testing • And ~90% of the rest by really rigorous testing But that still leaves 30-50, and getting to 99.9% is very expensive. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 6. Factors affecting bug density • Design – good designs lead to fewer bugs • Type of application: concurrent, reactive systems are much more difficult than sequential transformation systems. • Programming language: Java < C < Perl • Programmer competence and experience • In general expect 1-10 bugs per hundred lines • (Probably a lot less for pair programming, but at a factor of 2 cost). C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 7. When you can’t afford 30-50 bugs Major issue for safety critical systems, e.g. fly-by-wire. • Conventional aircraft: pilot input directly controls flight surfaces (via hydraulics in large aircraft). • FBW aircraft: a computer interprets the pilot’s inputs, and relays these electronically to the flight surfaces • First used in the F16, 1974. Allows military aircraft to be inherently unstable, hence more manoeuvrable (also helps stealth). • First civilian application Airbus A320, early 1980s. Provides protection and reduces pilot workoad. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 8. Triple redundancy (1) • Airbus claimed that the A320 FBW software was designed to fail no more than once in 109 flight hours. How could they possible claim that? • Once in 104.5 (33K) hours might be plausible – but nowhere near enough. • But add a second computer, with different software written by a different team. Now (in theory) both will fail at the same time once in 109 hours. • But if there is a discrepancy you don’t know which one’s wrong – so you need a third computer and take a majority vote: triple redundancy. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 9. Triple redundancy (2) Other advantages: • Provides graceful degradation: don’t have to revert to manual control immediately with one computer out. • Gives continuous testing for free – each discrepancy reveals a bug! So eventually the system should be extremely reliable – recent safety record of the A320 is outstanding. • Redundancy is essential to providing reasonable levels of safety in complex safety-critical systems. • Note: the actual A320 system has a lot more redundancy than described above C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 10. Quiz(1) Suggest at least three reasons why the theoretical sum 104.5 x 104.5 = 109 may not reflect what happens in practice. Hints: • Is there still a single point of failure in the system? • Remember: not all bugs are in the actual software • When is it true that P(A and B) = P(A) x P(B)? C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 11. Exhaustive testing is impossible public static double divide(double a, double b){ return a / b; } A Java double is 64 bits so there are 2128 possibilities – intractable. Similarly a reactive system such as FBW has a huge number of possible (state, input, time) combinations. So we have to find a large number of bugs within a huge search space – we have to focus effort on the most “interesting” parts of that space. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 12. Testing as a search problem • Equivalence partitioning: split up the space into areas where similar tests are likely to lead to similar results • e.g. if 2/3 works then 3/5 probably works too (but not necessarily 3/3 • Boundary value analysis: concentrate on boundaries between different parts of the space. • E.g. b == 0, b very close to 0, a and/or b close to MAX_DOUBLE etc. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 13. Black box or white box? Black box: testing the software against its spec without access to the code: • Means tests will be written without preconceptions about how the code works. • If the code is changed, the same tests are still valid. White box: testing with access to the code: • Allows more tests to be done • Allows tester to apply pressure to those places which look most likely to break. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 14. Quiz(2) 2. You are testing an algorithm which sorts strings into alphanumeric order for a dictionary program. Suggest some of the most important tests you’ll need to do. 3. You are asked to thoroughly test floating point division software which will be burnt into a processor chip. Would you go about this primarily though black box or white box testing, and why? C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 15. Kinds of testing • Unit testing – test one unit (in OO one class) at a time. • Integration testing – test that the components of a system (or subsystem) work together correctly • Regression/smoke testing – check that you haven’t broken it. • System testing – test that the system works in the context in which it will be required to work. • Alpha and beta testing – test with real users • Acceptance testing – get the customer to come up with the dosh. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 16. Unit testing • Testing one unit – class - at a time. • Relatively simple, but the class you’re testing will usually rely on other classes. • In general almost all software relies on other software (e.g. Java library classes). • The search space is generally well defined so techniques like EP ad BVA are most useful here. • Often possible to be systematic and reasonably confident that a single class is bug-free. • In Java, often done with the JUnit testing framework. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 17. Integration testing • Testing that the components of a system work together. • Harder to define than unit testing; shape of testing space is less obvious. • Concentrate on important mission-critical features • Check that the use cases can be performed without problems. • Don’t get upset when your code causes a problem; don’t get annoyed when somebody else’s does. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 18. Regression/smoke testing • Regression testing: repeat the tests you did before, to make sure you haven’t broken anything. • Especially important after significant changes but the more often the better. • Smoke testing: repeat the most critical tests as often as possible – check that it’s not going up in smoke. • Integration and Regression/smoke testing are often done in the form of a daily (or nightly) “build” of the system – requires that at least some tests are automated. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 19. System testing • Testing of the system in the context(s) in which it will operate. • This will generally be a lot more varied than the context in which it was developed. • May involve different hardware, operating systems, performance issues etc. • Need to check the documentation and procedures as well as the code. • Many systems which (seem to) work perfectly in a development environment fail in a customer environment. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 20. Alpha and beta testing • System testing with real users • Important because they don’t use the software the way you assume. • Alpha testing: a small group of users, done with SW developers present. • Beta testing: a wider group, remote from the development team, asked to submit bug reports. • Better not to start Beta testing until the software will work for most of the users most of the time! C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r
  • 21. Acceptance testing Where a SW product has a small number of large customers (e.g. Campus Solutions) the customer(s) may specify a set of tests which the SW must pass before they will accept it and pay the dosh. There are some serious issues with this: • In general, users don’t really know in advance what they want (the “waterfall fallacy”). • Who within the customer organisation defines the spec? e.g. Managers and end users will have different views. • Fixating on passing the acceptance test could result in serious problems being missed. C om b ining th e s tre ngth s of U M IS T and Th e Victoria U nive rs ity o f M anch e s te r