Com1040 Systems Design and Testing Part II – Testing (Based on A.J. Cowling’s lecture notes) LN-Test1+2: Introduction to Testing Marian Gheorghe ©University.

Slides:



Advertisements
Similar presentations
Testing Coverage Test case
Advertisements

Defect testing Objectives
Test Yaodong Bi.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
November 2005J. B. Wordsworth: J5DAMQVT1 Design and Method Quality, Verification, and Testing.
1 CODE TESTING Principles and Alternatives. 2 Testing - Basics goal - find errors –focus is the source code (executable system) –test team wants to achieve.
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
Introduction to Software Testing
Black Box Software Testing
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Test Design Techniques
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
Com1040 Systems Design and Testing Part II – Testing (Based on A.J. Cowling’s lecture notes) LN-Test3: Equivalence classes and boundary conditions Marian.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
Introduction Telerik Software Academy Software Quality Assurance.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Software Testing.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Software Engineering Chapter 23 Software Testing Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
University of Toronto Department of Computer Science CSC444 Lec08 1 Lecture 8: Testing Verification and Validation testing vs. static analysis Testing.
1 Phase Testing. \ 2 Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine subphases) Define Coding Standards.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
Neil Ghani Software testing. 2 Introduction In a perfect world all programs fully verified testing thus redundant Back in the real.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
Software Construction Lecture 18 Software Testing.
Presented by: Ritesh Jain Date: 16-Jun-05 Software Quality Testing.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Com1040 Systems Design and Testing Part II – Testing (Based on A.J. Cowling’s lecture notes) LN-Test4: Category-Partition Method Marian Gheorghe ©University.
What is Testing? Testing is the process of finding errors in the system implementation. –The intent of testing is to find problems with the system.
LECTURE 20 26/11/15. Summary - Testing ◦ Testing affects all stages of software engineering cycle ◦ One strategy is a bottom-up approach – class, integration,
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
Software Testing and Quality Assurance 1. What is the objectives of Software Testing?
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Dynamic Testing.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Testing Integral part of the software development process.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Software Testing. Software Quality Assurance Overarching term Time consuming (40% to 90% of dev effort) Includes –Verification: Building the product right,
A Review of Software Testing - P. David Coward
Software Testing.
Testing Tutorial 7.
Software Testing.
John D. McGregor Session 9 Testing Vocabulary
Black Box Testing PPT Sources: Code Complete, 2nd Ed., Steve McConnell
Software Engineering (CSI 321)
Input Space Partition Testing CS 4501 / 6501 Software Testing
CS5123 Software Validation and Quality Assurance
About the Presentations
John D. McGregor Session 9 Testing Vocabulary
UNIT-4 BLACKBOX AND WHITEBOX TESTING
John D. McGregor Session 9 Testing Vocabulary
Introduction to Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Verification and Validation
Software Verification and Validation
CSE403 Software Engineering Autumn 2000 More Testing
Software Testing.
Software Verification and Validation
CSE 1020:Software Development
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Com1040 Systems Design and Testing Part II – Testing (Based on A.J. Cowling’s lecture notes) LN-Test1+2: Introduction to Testing Marian Gheorghe ©University of SheffieldCom Testing

Introduction to testing Testing types Unit testing Specification-based testing AJC’s lecture notes at MG’s slides at: G.J. Myers, The Art of Software Testing, 1979 M. Roper, Software Testing, 1994 Testing -Summary

The Testing Problem - Triangle Example The aim of this program is to classify triangles. The program accepts three positive whole numbers as lengths of the sides of a triangle. The program classifies the triangle into one of the following groups: Equilateral: all the sides have equal lengths (return 1) Isosceles: two sides have equal length, but not all three (return 2) Scalene: all the lengths are unequal (return 3) Impossible: the three lengths cannot be used to form a triangle, or form only a flat line (return 4) (it appears in Myers’ book) Find test cases which adequately runs or abruptly breaks it down. An example…

Java Solution int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene }

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3)

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3)

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3)

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3)

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3)

Java Solution & Test int triangle(int a, int b, int c) { int mx, x, y; mx = a; x = b; y = c; if (mx < b) {x = mx; mx = b;} if (mx < c) {y = mx; mx = c;} if (mx >= x + y) {return 4; // impossible} if (a == b && b == c) {return 1; // equilateral} if (a == b || b == c || a == c) {return 2; // isosceles} return 3; // scalene } White box: code coverage (3,5,3) Correct!

Motivation for Software Testing Testing part of any scientific and engineering activity Software testing needed – errors are unavoidable: psychology of testing - limited capacity and performances of the human memory layers short term medium term long term – history of software Ariane 5 failure, 1996: Genomic data, Science 2007

Errors in Software Processes Errors may occur in any stage of a software project: requirements capture: misinterpreted or incomplete aspects, incorrect statements etc specifications: wrong/inadequate notations, missing reqs, unnecessary components etc design: wrongly reflected specifications, wrong diagrams etc code: syntax, logical, I/O errors, format etc

Definitions of Testing Hetzel: Any activity aimed at evaluating an attribute or capability of a program or system. Myers: The process of executing a program with the intent of finding errors. IEEE: The process of exercising or evaluating a system or system component by manual or automated means to verify that it satisfies specified requirements or to identify differences between expected and actual results.

Testing Processes Test case Test set Test script Test execution Test analysis Test suite Anatomy of a test case: What are the parts of a test case? a description of input condition(s) a description of expected results Where do ‘‘expected results’’ come from?

Brief History of Software Testing* Debugging, up to 1956 Demonstration, Destruction, Evaluation, … Focus on shorter development cycles, after 1990 *Some details and examples follow from - University of Florida

Performing Testing When might testing guarantee an error-free program? When branch, condition, and loop coverage are achieved When dataflow testing is utilized When path and compound condition coverage are achieved When all combinations of all possible input and state variable values are covered (None of the above ?)

Performing Testing When Might Testing Guarantee an Error-Free Program? When branch, condition, and loop coverage are achieved When dataflow testing is utilized When path and compound condition coverage are achieved When all combinations of all possible input and state variable values are covered = exhaustive testing (None of the above)

Exhaustive testing Example: A module has 2 input parameters. Word size is 32 bits. Testing is completely automated: 100 nanoseconds are required for each test case. Question: How long would it take to test this module exhaustively, i.e., covering every possible combination of input values?

Exhaustive Testing - Answers Short Answer: too long… Long Answer: 2 64 X 100 X         > 57,000 years! 3600 X 24 X 365

Exhaustive Testing - Answers Short Answer: too long… Long Answer: 2 64 X 100 X         > 57,000 years! 3600 X 24 X 365

Properties of Testing Methods Construction of a test set of reasonable size Any bigger test set should show better achievements Relevant aspects of the product are covered Catch adequate faults

Various classifications Random testing – generate random test sets Implementation-based testing (white box, glass box – start from code) Specification-based testing (black box – use the, formal or informal, specification) Hybrid testing – mixture of the above Other classifications consider the amount of code (unit vs integration, system testing), performance (stress testing), usability (acceptance testing) etc. We focus on (1) white box unit testing and black box integration testing utilising category-partition method Testing types

You have learned about JUnit (Com1020 – 2 nd lecture) public class MyClass { public static double myMeth(Params) { … some code } … } public class TestMyClass public void fTestSomeFunctionality() { assertEquals(val, MyClass.myMeth(someVals), errApp); } … } White box unit testing Current class, method Testing suite

Through assertEquals(val, MyClass.myMeth(someVals), errApp); results returned by a method, myMeth(), of a class, MyClass, (in a certain stage of its development) are compared with predefined values, val, for some given inputs, someVals. Reminds pre- and post-conditions utilised by formal methods, including Z, to specify correct behaviour Problem: how do we choose val and someVals JUnit testing principle

Test every unit of code – java method: As complete as possible code coverage Using category-partition to identify suitable inputs – remember (3,5,3) for the “triangle” problem Generate suitable test sets Aim of unit testing for Crossover

Starting from specifications May apply to unit as well as integration and system testing Specifications may be informal – plain English or (semi)formal – diagrams or specific notations Z may be suitable for black box unit testing X-machines for black box system testing: appropriate sequence of correct functions Two more concepts, related to data set selection, apply: equivalence partition and boundary conditions Specification-based methods

Equivalence partition: Data set identification Exhaustive testing is not possible Identify in the set of input data “equivalent” elements – leading to similar behaviour; ex in triangle program (3,5,3), (30,50,30), (4,6,4) show the same behaviour and result, whereas (3,7,3) doesn’t! why? Enough to use one representative per equivalent class

Example Mail-order firm wants to use a computer system to handle customer accounts. In particular, at the end of each month, they require the system to print out a statement for each customer, detailing their purchases during the month together with their current credit rating. The system must also send out invoices to customers with outstanding payments, and should not send anything to customers who bought nothing in the past month, and owe nothing for earlier items. We need to partition: customers set, their balances, orders set, addresses set

Example cont Mail-order firm wants to use a computer system to handle customer accounts. In particular, at the end of each month, they require the system to print out a statement for each customer, detailing their purchases during the month together with their current credit rating. The system must also send out invoices to customers with outstanding payments, and should not send anything to customers who bought nothing in the past month, and owe nothing for earlier items. Customer partition: no customers, one customer, more than one - 3 Balance partition: customers with negative, positive, exact – 3 Orders partition: no orders, one page, more than one – 3 Addresses partition: 1 st class, 2 nd class, Eu, rest of the world - 4

Example - analysis Mail-order firm wants to use a computer system to handle customer accounts. In particular, at the end of each month, they require the system to print out a statement for each customer, detailing their purchases during the month together with their current credit rating. The system must also send out invoices to customers with outstanding payments, and should not send anything to customers who bought nothing in the past month, and owe nothing for earlier items. If independent cases then 3  3  3  4 equivalence classes, but Empty set of customers leads to one test No need to consider 3  3  4 cases for one and many customers So, 3  3  would suffice

Conclusions Concepts related to testing introduced Need of testing showed Testing capabilities discussed White and black box testing defined and white box unit testing illustrated