CSC 480 Software Engineering Lecture 15 Oct 21, 2002.

Slides:



Advertisements
Similar presentations
Software Engineering COMP 201
Advertisements

Software testing.
Defect testing Objectives
การทดสอบโปรแกรม กระบวนการในการทดสอบ
Chapter 10 Software Testing
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Software Engineering, COMP201 Slide 1 Software Testing Lecture 28 & 29.
Software testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Final Project Account for 40 pts out of 100 pts of the final score 10 pts from.
Software Testing and Quality Assurance
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
1 Software Testing and Quality Assurance Lecture 30 - Introduction to Software Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing 2.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Software Engineering Software Testing.
CS 425/625 Software Engineering Software Testing
Chapter 18 Testing Conventional Applications
- Testing programs to establish the presence of system defects -
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
©Ian Sommerville 1995 Software Engineering, 5th edition. Chapter 22Slide 1 Verification and Validation u Assuring that a software system meets a user's.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 23 Slide 1 Software testing Slightly adapted by Anders Børjesson.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Testing Hoang Huu Hanh, Hue University hanh-at-hueuni.edu.vn.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Integration testing l Tests complete systems or subsystems composed of integrated.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Testing phases. Test data Inputs which have been devised to test the system Test cases Inputs to test the system and the predicted outputs from these.
Chapter 12: Software Testing Omar Meqdadi SE 273 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Software testing techniques 3. Software testing
©Ian Sommerville 1995/2000 (Modified by Spiros Mancoridis 1999) Software Engineering, 6th edition. Chapters 19,20 Slide 1 Verification and Validation l.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Chapter 20 Software Testing.
CSC 480 Software Engineering Lecture 14 Oct 16, 2002.
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
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.
1 Software Defect Testing Testing programs to establish the presence of system defects.
Csi565: Theory and Practice of Software Testing Introduction Spring 2009.
Software Testing. 2 CMSC 345, Version 4/12 Topics The testing process  unit testing  integration and system testing  acceptance testing Test case planning.
This chapter is extracted from Sommerville’s slides. Text book chapter
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Chapter 8 Lecture 1 Software Testing. Program testing Testing is intended to show that a program does what it is intended to do and to discover program.
Software process model from Ch2 Chapter 2 Software Processes1 Requirements Specification Design and Implementation ValidationEvolution.
CSC 480 Software Engineering Testing - I. Plan project Integrate & test system Analyze requirements Design Maintain Test units Implement Software Engineering.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
CS 360 Lecture 16.  For a software system to be reliable:  Each stage of development must be done well, with incremental verification and testing. 
CS 240, Prof. Sarwar Slide 1 CS 240: Software Project Fall 2003 Sections 1 & 2 Dr. Badrul M. Sarwar San Jose State University Lecture #18.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
CS 240, Prof. Sarwar Slide 1 CS 240: Software Project Fall 2003 Sections 1 & 2 Dr. Badrul M. Sarwar San Jose State University Lecture #17.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Topic: Junit Presenters: Govindaramanujam, Sama & Jansen, Erwin.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
ANOOP GANGWAR 5 TH SEM SOFTWARE TESTING MASTER OF COMPUTER APPLICATION-V Sem.
Defect testing Testing programs to establish the presence of system defects.
IS301 – Software Engineering V:
Chapter 8 – Software Testing
Chapter 18 Software Testing Strategies
Software testing strategies 2
Verification and Validation
Software testing.
Defect testing Testing programs to establish the presence of system defects.
Presentation transcript:

CSC 480 Software Engineering Lecture 15 Oct 21, 2002

White-box Testing Based on knowledge of structural details Objective and coverage  Every statement has been executed at least once  Every linearly independent path has been traversed at least once Path coverage ensures statement coverage

Flow Chart vs. Flow Graph

Binary search (Java) This is an encapsulation of a binary search function that takes an array of ordered objects and a key and returns an object with 2 attributes namely index - the value of the array index found - a boolean indicating whether or not the key is in the array An object is returned because it is not possible in Java to pass basic types by reference to a function and so return two values the key is -1 if the element is not found

Binary search flow graph

1, 2, 3, 8, 9 1, 2, 3, 4, 6, 7, 2 1, 2, 3, 4, 5, 7, 2 1, 2, 3, 4, 6, 7, 2, 8, 9 Test cases should be derived so that all of these paths are executed A dynamic program analyser may be used to check that paths have been executed Independent paths

Cyclomatic Number In graph-theoretic terms, the cyclomatic number of a graph G is defined as C = E – N + 2P where  N is the number of nodes  E is the number of edges  P is the number of connected components (usually, 1)

Cyclomatic Complexity McCabe suggested that the number C can be used as a source-code metric  that reflects the complexity of a program’s control flow C defines the number of linearly independent paths in a program  It can be used as an upper bound for the number of tests that must be conducted

Alternative Ways to Compute C There are other ways that can be used to determine the cyclomatic number C  C = P + 1 where P is the number of predicate nodes contained in the flow graph  C = R where R is the number of regions into which the flow graph divides the plane

Integration testing Tests complete systems or subsystems composed of integrated components Integration testing should be black-box testing with tests derived from the specification Main difficulty is localising errors Incremental integration testing reduces this problem

Incremental integration testing

Approaches to integration testing Top-down testing  Start with high-level system and integrate from the top-down replacing individual components by stubs where appropriate Bottom-up testing  Integrate individual components in levels until the complete system is created In practice, most integration involves a combination of these strategies

Top-down testing

Bottom-up testing

Takes place when modules or sub-systems are integrated to create larger systems Objectives are to detect faults due to interface errors or invalid assumptions about interfaces Particularly important for object-oriented development as objects are defined by their interfaces Interface testing

Interfaces types Parameter interfaces  Data passed from one procedure to another Shared memory interfaces  Block of memory is shared between procedures Procedural interfaces  Sub-system encapsulates a set of procedures to be called by other sub-systems Message passing interfaces  Sub-systems request services from other sub- systems

Interface errors Interface misuse  A calling component calls another component and makes an error in its use of its interface e.g. parameters in the wrong order Interface misunderstanding  A calling component embeds assumptions about the behaviour of the called component which are incorrect Timing errors  The called and the calling component operate at different speeds and out-of-date information is accessed

Interface testing guidelines Design tests so that parameters to a called procedure are at the extreme ends of their ranges Always test pointer parameters with null pointers Design tests which cause the component to fail Use stress testing in message passing systems In shared memory systems, vary the order in which components are activated

Stress testing Exercises the system beyond its maximum design load. Stressing the system often causes defects to come to light Stressing the system test failure behaviour.. Systems should not fail catastrophically. Stress testing checks for unacceptable loss of service or data Particularly relevant to distributed systems which can exhibit severe degradation as a network becomes overloaded

The components to be tested are object classes that are instantiated as objects Larger grain than individual functions so approaches to white-box testing have to be extended No obvious ‘top’ to the system for top-down integration and testing Object-oriented testing

Testing levels Testing operations associated with objects Testing object classes Testing clusters of cooperating objects Testing the complete OO system

Object class testing Complete test coverage of a class involves  Testing all operations associated with an object  Setting and interrogating all object attributes  Exercising the object in all possible states Inheritance makes it more difficult to design object class tests as the information to be tested is not localised

Writing A TestCase import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class MoneyTest extends TestCase { private Money f12CHF; private Money f14CHF; private Money f28USD; protected void setUp() { f12CHF= new Money(12, "CHF"); f14CHF= new Money(14, "CHF"); f28USD= new Money(28, "USD"); }

Writing testMethod ’s public void testSimpleAdd() { Money m12CHF= new Money(12, "CHF"); Money m14CHF= new Money(14, "CHF"); Money expected= new Money(26, "CHF"); Money result= m12CHF.add(m14CHF); assert(expected.equals(result)); } // [12 CHF] + [14 CHF] + [28 USD] == {[26 CHF][28 USD]} public void testMoneyMoneyBag() { Money bag[]= { f26CHF, f28USD }; MoneyBag expected= new MoneyBag(bag); assertEquals(expected, f12CHF.add(f28USD.add(f14CHF))); }

TestSuite & Running Tests public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new MoneyTest("testMoneyEquals")); suite.addTest(new MoneyTest("testSimpleAdd")); return suite; } public static void main(String args[]) { junit.swingui.TestRunner.run(suite()); }

Object integration Levels of integration are less distinct in object- oriented systems Cluster testing is concerned with integrating and testing clusters of cooperating objects Identify clusters using knowledge of the operation of objects and the system features that are implemented by these clusters

Approaches to cluster testing Use-case or scenario testing  Testing is based on a user interactions with the system  Has the advantage that it tests system features as experienced by users Object interaction testing  Tests sequences of object interactions that stop when an object operation does not call on services from another object

Association – The Bank Client App BankClientMainBankClientFrame BankClientConnector request(String cmd):String

Scenario-based testing Identify scenarios from use-cases and supplement these with interaction diagrams that show the objects involved in the scenario Consider the scenario in the weather station system where a report is generated

Collect weather data