SlideShare una empresa de Scribd logo
1 de 25
[object Object],[object Object]
Our goal: write a function to calculate the length of the hypotenuse of a right-angled triangle from the other two sides
 
 
 
[object Object]
 
[object Object]
 
 
[object Object]
 
 
[object Object],[object Object]
We need to do each test lots of times. ,[object Object],[object Object]
 
[object Object]
[object Object]
A suite function that runs some or all of the tests.
[object Object]
A suite function that runs some or all of the tests.
Some utility functions for handling errors and displaying results.
 
 
 

Más contenido relacionado

La actualidad más candente

Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapaloozaJenniferBall44
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7ashhadiqbal
 
Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDLAbd17m
 
Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDLAbd17m
 
Nairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akkaNairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akkaAD_
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2Bianca Teşilă
 
CS106 Lab 7 - For loop
CS106 Lab 7 - For loopCS106 Lab 7 - For loop
CS106 Lab 7 - For loopNada Kamel
 
Analytical Models of Parallel Programs
Analytical Models of Parallel ProgramsAnalytical Models of Parallel Programs
Analytical Models of Parallel ProgramsDr Shashikant Athawale
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7ashhadiqbal
 
CS106 Lab 3 - Modulus
CS106 Lab 3 - ModulusCS106 Lab 3 - Modulus
CS106 Lab 3 - ModulusNada Kamel
 
Iterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khuranaIterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khuranaGaurav Khurana
 
CS106 Lab 8 - Nested loops
CS106 Lab 8 - Nested loopsCS106 Lab 8 - Nested loops
CS106 Lab 8 - Nested loopsNada Kamel
 
lazy evaluation
lazy evaluationlazy evaluation
lazy evaluationRajendran
 
recursive problem_solving
recursive problem_solvingrecursive problem_solving
recursive problem_solvingRajendran
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialKuntal Bhowmick
 

La actualidad más candente (20)

Experiment 9(exceptions)
Experiment 9(exceptions)Experiment 9(exceptions)
Experiment 9(exceptions)
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapalooza
 
2CPP18 - Modifiers
2CPP18 - Modifiers2CPP18 - Modifiers
2CPP18 - Modifiers
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7
 
Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDL
 
Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDL
 
Nairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akkaNairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akka
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2
 
CS106 Lab 7 - For loop
CS106 Lab 7 - For loopCS106 Lab 7 - For loop
CS106 Lab 7 - For loop
 
Analytical Models of Parallel Programs
Analytical Models of Parallel ProgramsAnalytical Models of Parallel Programs
Analytical Models of Parallel Programs
 
Var arg methods
Var arg methodsVar arg methods
Var arg methods
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7
 
SD & D Arithmetic Operators
SD & D Arithmetic OperatorsSD & D Arithmetic Operators
SD & D Arithmetic Operators
 
CS106 Lab 3 - Modulus
CS106 Lab 3 - ModulusCS106 Lab 3 - Modulus
CS106 Lab 3 - Modulus
 
Iterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khuranaIterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khurana
 
CS106 Lab 8 - Nested loops
CS106 Lab 8 - Nested loopsCS106 Lab 8 - Nested loops
CS106 Lab 8 - Nested loops
 
lazy evaluation
lazy evaluationlazy evaluation
lazy evaluation
 
recursive problem_solving
recursive problem_solvingrecursive problem_solving
recursive problem_solving
 
Functions
FunctionsFunctions
Functions
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorial
 

Similar a Why use testing frameworks - Richard Cotton

Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptxNileshBorkar12
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingMax Kleiner
 
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and TensorfowAaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and TensorfowAminaRepo
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptxSayanSen36
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdfNayanChandak1
 
To Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMETo Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMESafe Software
 
Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Codemotion
 

Similar a Why use testing frameworks - Richard Cotton (20)

Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software Testing
 
Instant DBMS Homework Help
Instant DBMS Homework HelpInstant DBMS Homework Help
Instant DBMS Homework Help
 
Lab5
Lab5Lab5
Lab5
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and TensorfowAaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
TDD Training
TDD TrainingTDD Training
TDD Training
 
To Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMETo Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FME
 
Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018Mario Fusco - Lazy Java - Codemotion Milan 2018
Mario Fusco - Lazy Java - Codemotion Milan 2018
 
Lazy java
Lazy javaLazy java
Lazy java
 
Lazy Java
Lazy JavaLazy Java
Lazy Java
 
Lazy Java
Lazy JavaLazy Java
Lazy Java
 
Testing
TestingTesting
Testing
 

Último

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Último (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Why use testing frameworks - Richard Cotton

Notas del editor

  1. In this short presentation, I'm going to try and persuade you that you should be using a testing framework for any software that you write. The example we'll look at uses MATLAB, but the argument is applicable to any software development.
  2. Hopefully you'll be looking at this problem and thinking “this is easy, I learnt Pythagoras's theorem when I was in school”. That's good. In that case our first attempt at solving the problem will look familiar to you.
  3. As Pythagoras said, “the square of the longest side is equal to the sum of the squares of the other two sides”, or whatever the Greek equivalent is. This looks like we might have cracked it straight away. Let's test it and find out.
  4. First we test the function under normal conditions. As every school-kid knows, for a right-angled triangle with sides of length 3 and 4, the hypotenuse squared is 3 squared plus 4 squared, which is 25 and so the hypotenuse is of length 5. Likewise, the hypotenuse of the unit square is root 2. So far, so good.
  5. What if we don't pass the function any arguments? This test shows that an error is thrown when no arguments are passed to the function. You may decide that that is the most appropriate behaviour. On this occasion, let's decide that we want default values.
  6. Here's our second attempt. The additional code sets a default value of 1 when no input was passed for that length.
  7. Now that we've changed the function, we need to check that our new code passes the test. Happily, in this case it does.
  8. Another test is to see what happens when you pass empty inputs in to the function. Empty inputs should probably work in the same way as no inputs, so we have a problem here.
  9. Here's our third attempt. We need to test that this version works with empty inputs but we also need to check that we haven't introduced new bugs. Running your old tests to make sure that there are no new bugs is called regression testing.
  10. Here is our set of tests again. As you can imagine, typing in all these tests every time you change something is already really time consuming, and we're not done yet.
  11. If you've done any numeric programming before, you'll have realised that bad things often happen when you introduce very big or very small inputs. In this case, squaring the numbers causes them to over or underflow.
  12. This fourth attempt is the version that most modern scientific software uses. Explaining how it works is beyond the scope of this presentation. The important thing is that we've changed the function, so we need to run all the tests again.
  13. I'm now really bored of typing in tests, and yet we still haven't exhausted the test possibilities, e.g., What happens when non-numeric arguments are passed? What happens if non-scalar arguments are passed? What happens in the 3D (or higher dimension) case?
  14. So we've established two things. That we need to write lots of tests, and that we need to run each test lots of times. In order to save our sanity, we need a way of easily creating and running and maintaining these tests. Otherwise, laziness will take over and we'll just not bother.
  15. We could write our own function to run the tests. This is much better, but notice that there's a lot of effort involved in displaying the results, when we really just want to think about the tests themselves.
  16. A testing framework is just a formalised version of the contents of the previous slide. They generally consist of: Lots of short functions or methods representing individual tests
  17. A suite function that runs some or all of the tests.
  18. And some utility functions for handling errors and displaying results.
  19. Here's an example using the MATLAB xUnit framework. To use it, first, we create some test functions, and place them in the same directory. Here you can see the five tests we thought of earlier.
  20. We just need two more lines of code. The first line creates a suite of tests from each function, and the second line runs them all, telling us that we passed them.
  21. If we run the tests on our original version of the function instead, then the test suite shows us where our problems lie.
  22. To summarise: Firstly, thorough testing is necessary, even when you think the answer should be easy. In this case, the overflow bug was quite obscure, and you might not have picked up on it without testing.
  23. Secondly, if we use a testing framework, then thorough testing needn't be onerous. Each test was a one line function, creating and running the suite were one line each.
  24. These two ideas taken together imply that testing frameworks are a great idea.
  25. If you want to find out more, then check out these resources. Thanks for listening.