An Introduction to Systematic Software Testing. Robert France CSU

Similar documents
Verification and Validation. Assuring that a software system meets a user s needs. Verification vs Validation. The V & V Process

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn. 4. Testing

Aerospace Software Engineering

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing.

Testing Process and Methods. CS 490MT/5555, Spring 2017, Yongjie Zheng

Chapter 11, Testing. Using UML, Patterns, and Java. Object-Oriented Software Engineering

Testing & Debugging TB-1

Verification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1

Part 5. Verification and Validation

(See related materials in textbook.) CSE 435: Software Engineering (slides adapted from Ghezzi et al & Stirewalt

Topics in Software Testing

SFWR ENG 3S03: Software Testing

Verification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1

Introduction to Dynamic Analysis

Software Testing part II (white box) Lecturer: Giuseppe Santucci

Lecture 15 Software Testing

Software Testing. Software Testing

In this Lecture you will Learn: Testing in Software Development Process. What is Software Testing. Static Testing vs.

Verification and Validation

Darshan Institute of Engineering & Technology for Diploma Studies

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Unit Testing. Emina Torlak

Chapter 8 Software Testing. Chapter 8 Software testing

Software Verification and Validation. Prof. Lionel Briand Ph.D., IEEE Fellow

Lecture 26: Testing. Software Engineering ITCS 3155 Fall Dr. Jamie Payton

Software Testing. Lecturer: Sebastian Coope Ashton Building, Room G.18

Facts About Testing. Cost/benefit. Reveal faults. Bottom-up. Testing takes more than 50% of the total cost of software development

Terminology. There are many different types of errors and different ways how we can deal with them.

Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 22 Slide 1

Software Engineering (CSC 4350/6350) Rao Casturi

Topic: Software Verification, Validation and Testing Software Engineering. Faculty of Computing Universiti Teknologi Malaysia

Verification and Validation

Testing. Prof. Clarkson Fall Today s music: Wrecking Ball by Miley Cyrus

UNIT-4 Black Box & White Box Testing

Program Analysis. Program Analysis

Software Testing for Developer Development Testing. Duvan Luong, Ph.D. Operational Excellence Networks

Software Quality Assurance. David Janzen

Software Engineering 2 A practical course in software engineering. Ekkart Kindler

Structural Testing. White Box Testing & Control Flow Analysis

White Box Testing III

UNIT-4 Black Box & White Box Testing

Program Verification! Goals of this Lecture! Words from the Wise! Testing!

Objectives. Chapter 19. Verification vs. validation. Topics covered. Static and dynamic verification. The V&V process

INTRODUCTION TO SOFTWARE ENGINEERING

1 Visible deviation from the specification or expected behavior for end-user is called: a) an error b) a fault c) a failure d) a defect e) a mistake

Three General Principles of QA. COMP 4004 Fall Notes Adapted from Dr. A. Williams

1 Black Box Test Data Generation Techniques

Testing! The material for this lecture is drawn, in part, from! The Practice of Programming (Kernighan & Pike) Chapter 6!

Software Testing. Software Testing. in the textbook. Chapter 8. Verification and Validation. Verification and Validation: Goals

Lecture 20: SW Testing Presented by: Mohammad El-Ramly, PhD

Testing & Continuous Integration. Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 20 03/19/2010

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/10/2015

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

Program Correctness and Efficiency. Chapter 2

Software Testing TEST CASE SELECTION AND ADEQUECY TEST EXECUTION

Software Engineering Fall 2014

CS 520 Theory and Practice of Software Engineering Fall 2018

Exceptions and Design

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems)

Good Luck! CSC207, Fall 2012: Quiz 3 Duration 25 minutes Aids allowed: none. Student Number: Lecture Section: L0101. Instructor: Horton

CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING

Black Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing

Ingegneria del Software II academic year: Course Web-site: [

Announcements. Testing. Announcements. Announcements

Testing. ECE/CS 5780/6780: Embedded System Design. Why is testing so hard? Why do testing?

Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation

Testing. Unit, integration, regression, validation, system. OO Testing techniques Application of traditional techniques to OO software

Second assignment came out Monday evening. Find defects in Hnefetafl rules written by your classmates. Topic: Code Inspection and Testing

EXAMINING THE CODE. 1. Examining the Design and Code 2. Formal Review: 3. Coding Standards and Guidelines: 4. Generic Code Review Checklist:

Testing! The material for this lecture is drawn, in part, from! The Practice of Programming (Kernighan & Pike) Chapter 6!

6. Test-Adequacy. Assessment Using Control Flow and Data Flow. Andrea Polini

People tell me that testing is

Part I: Preliminaries 24

The Importance of Test

Softwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany

Softwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany

Chapter 10. Testing and Quality Assurance

MONIKA HEINER.

CISC327 - So*ware Quality Assurance. Lecture 13 Black Box Unit

Software Testing. Testing: Our Experiences

Software Testing. Software Testing. in the textbook. Chapter 8. Verification and Validation. Verification Techniques

Software Design Models, Tools & Processes. Lecture 6: Transition Phase Cecilia Mascolo

10. Software Testing Fundamental Concepts

Modern Methods in Software Engineering. Testing.

Stack Implementation

Course Content. Objectives of Lecture 18 Black box testing and planned debugging. Outline of Lecture 18

Verification and Validation. Verification and validation

XVIII. Software Testing. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Object-Oriented Software Engineering Practical Software Development using UML and Java

Software Testing. 1. Testing is the process of demonstrating that errors are not present.

SE 3S03 - Tutorial 10. Helen Brown. Week of Mar 23, 2015

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course

Principles of Software Construction: Testing: One, Two, Three

Darshan Institute of Engineering & Technology Unit : 9

Introduction to Programming Using Java (98-388)

ITI Introduction to Computing II

Agile Software Development. Lecture 7: Software Testing

Chap 2. Introduction to Software Testing

CSIS 10B Lab 2 Bags and Stacks

3. Design by Contract

Transcription:

An Introduction to Systematic Software Testing Robert France CSU

Why do we need to systematically test software? Poor quality products can Inconvenience direct and indirect users Result in severe financial costs Kill/maim users Entangle society Damage reputations Quality puts Large amounts of money at stake Corporate success/failure at stake Developer s personal future at stake Lives at stake Systematic software testing is a quality control activity 2

Quality Control (QC) QC is the set of techniques and practices used by developers to help ensure software quality QC Activities Validation & Verification Analysis and simulation of design specifications or models Program testing Software reviews, walkthroughs, inspections Process Improvement Change Control Software configuration management 3

Validation Validation is concerned with establishing that the software satisfies the specified and unspecified customer goals. We ask: Did we build the right thing? 4

Verification Verification is concerned with establishing that the software meets specified goals. We ask: ``Did we build the thing right?'' 5

Testing Run (exercise) the program on sample inputs. Check the validity of the output. If output is valid then test provides some evidence of validity Testing is part of either verification or validation. 6

Who Should Conduct Testing? Should the developer do the testing? Should we use an independent testing team? 7

Testing Programs Testing can show the presence of errors, but never their absence Testing should be considered as only one means of identifying errors and should be integrated with other V&V techniques Testing should be based on sound and systematic techniques 8

Limitations of Ad-hoc Testing Suppose a programmer set z to 2 instead of 22 when x equals y in the code below: read(x); read(y); if x=y then z:=2; else z:=0; endif; write(z); Using a random number generator to generate values for x and y in the tests will not likely produce equal values for x and y. 9

Testing Terminology Testing terminology is not standardized. Failure: invalid behavior A failure occurs when a program executing on input data produces incorrect output. Defect, error: cause of a failure Some texts make a distinction between errors and defects (e.g., see course text), where an error is a behavior by the programmer (e.g., a bad decision) that leads to a defect in software. Fault: an incorrect intermediate state that may be entered during program execution a failure occurs only if a fault happens during execution A fault occurs only if an error exists in the program 10

Testing Terminology (2) Analysis: a search for failures by experimentation (e.g., testing) or static analysis. Defect removal (debugging): search for errors and their repair. Test case: a set of values for the input variables of a program Test set: a finite set of test cases A program P is correct for a test set T if it produces the correct output for each test set in T. T is said to be successful for P. 11

Levels of Program Testing Testing-in-the-small Unit testing: testing a procedure, function, or class. Testing-in-the-large Integration testing: testing connections between units and components. System testing: test entire system. Acceptance testing: testing to decide whether to purchase the software. 12

Levels of Program Testing (2) Alpha testing: system testing by a user group within the developing organization. Beta testing: system testing by select customers. Regression testing: retesting after a software modification. 13

Dynamic Fault Classification Logic faults: omission or commission. Overload: data fields are too small. Timing: events are not synchronized. Performance: response is too slow. Environment: error caused by a change in the external environment. 14

Test Oracles Determine whether a test completed with or without errors. Often a person who monitors output. Not a reliable method. Automatic oracles check output using another program. Requires a formal specification of input/output relationship 15

Key Testing Questions How do we know that we have selected an adequate set of test cases? How can we determine the extent that selected test cases cover the software input domain? Did we cover all the inputs that would typically be input to the software in the tests? Did we cover all the representative inputs indicating different usages (including bad uses) of the software in the tests?

A Pragmatic Testing Strategy 1. Divide domain D into sub-domains D1, D2,..., Dn; each sub-domain represents some aspect of the program. 2. Select at least one test case from each Di. 17

An Example Calculating the factorial of a number: If n<0 then output error message If 0<=n<20 then compute n! If 20<=n<200 then approximate n! If n > 200 output error message Possible domains are suggested by the problem statement: {n n<0}, {n 0<=n<20}, {n 20<=n<200 }, {n n > 200 } One can reasonably expect that if a program behaves for one value in a subdomain it will work for other values. 18

Test Adequacy Criteria Question: How do we identify the sub-domains? Answer: Use test adequacy criteria A test criterion attempts to group elements in D into subdomains D1,, Dn, such that the elements of a given subdomain are expected to behave in exactly the same manner. For each subdomain we can choose a single test case as representative of the input values in the subdomain If D = D1 U D2 U U Dn we say that the test criterion satisfies the complete coverage principle

Another Example Suppose we use a criterion that results in the following sub-domains for a program: D1={d d mod 2=0}, D2={d d<=0}, D3={d d mod 2 not= 0} Note that D1 and D2 have common elements, thus we can choose two elements (instead of 3) and satisfy the completecoverage principle. The test set {x=48; x=-37} 20

Unit Testing White box testing: using knowledge of the structure of a program to produce test cases. Black box testing: testing a program using test cases that are generated without knowledge of the design and implementation Both approaches are complementary White box testing tests what a program does Black box testing tests what a program is supposed to do 21

White box testing criteria Statement coverage criterion: Select a test set T such that executing program P for each d in T results in each elementary statement of P being executed at least once. Edge-coverage criterion: Select a test set T such that executing P for each d in T results in each edge of P s control graph being traversed at least once. Condition-coverage criterion: Select a test set T such that executing P for each d in T results in each edge of P s control graph being traversed at least once and all possible values of the constituents of compound conditions being exercised at least once. Path-coverage criterion: Select a test set T such that executing P for each d in T results in all paths leading from the initial to the final node of P s control graph being traversed. 22

Statement coverage example 1. read(x); 2. read(y); 3. if x > 0 then 4. write( 1 ); 5. else 6. write( 2 ); 7. end if; 8. If y > 0 then 9. write( 3 ); 10.else 11. write( 4 ); 12.end if; Input domains for statement coverage D1: {x>0} D2:{x<=0} D3: {y>0} D4:{y<=0} How did we get these domains? Ans: from the branch conditions.

Statement coverage weakness 1. if x < 0 then 2. x := -x; 3. end if; 4. z:=x; Input domains for statement coverage D1: {x<0} Weakness: does not cover the case when x >= 0. A test set that satisfies the edgecoverage criterion will cover the case when x>=0.

Control Flow Graph examples x:=y+1 x:=y y:=x x:=y Simple statement (e.g., x:= y+1) y:=z-y If C then x:=y else y:=x If C then x:=y Sequence of statements (x:= y+1; y:=z-y;) x:=y while C do x:=y

Condition coverage vs. edge coverage criterion found:= false; counter:= 1; while (not found) and counter < num_items loop if table(counter) = desired_elem then found := true; end if; counter := counter + 1; end loop; If found then write( element found ); else write( element does not exist ); end if;

Edge criterion test set weakness A test set for the program on previous slide: A table with no items A table with three items, the second being the desired element. The above satisfies the edge coverage criterion but fails to uncover the error in the condition of the while loop (< instead of <=) The coverage criterion can be used to uncover this error.

Edge coverage weakness if x not = 0 then y:=5; else z:=z-x; end if; if z > 1 then z:=z/x; else z:=0; end if; The following test set satisfies the edge criterion: {<x=0,z=1>,<x=1,z=3>} It does not uncover the division by 0 error. A test set that uncovers the error is given below: {<x=0,z=3>,<x=1,z=1>}

White-box testing summary Tests what a program does Can catch only errors of commission ; cannot catch errors of omission Black box testing can be used to catch errors of omission. It is not always possible to select test sets that satisfy criterion E.g., unreachable statements in code makes it impossible to satisfy statement coverage criterion

Testing Limitations If our testing results in: 100% statement coverage, 100% branch coverage, 100% condition coverage, The program may still have hidden faults. Why? 30

Black box testing example Program specification: The program receives an invoice as input (detailed description of invoice structure that follows is excluded here). The invoice must be inserted into an invoice file that is sorted by date. The invoice must be inserted in the appropriate position: If other invoices exist in then file with the same date, then the invoice should be inserted after the last one. Also, some consistency checks must be performed: the program should verify whether the customer is already in a corresponding file of customers, whether the customer s data in the two files match, Test set Invoice whose date is the current date Invoice whose date is before the current date Invoice whose date is the same as that of some existing invoice Invoice whose date does not exist in invoice file Incorrect invoices that can be used to check different types of inconsistencies

Testing boundary conditions Some programming errors are on the boundary of input domains/partitions used for testing. if x > y then dosomething; else dosomethingelse end if; Input domains D1:{x>y} D2:{x <= y} Easy to miss the case x=y when selecting from D2. Rule of thumb: test using values at the boundaries of the input domains.

Black-Box Class Testing Black-Box testing: test a component taking an external view. Use the specification to derive test cases. No access to source code. Black-Box class testing. Generate tests by analyzing the class interface. Don t look at method bodies. 33

Black-Box Class Testing (2) Look at the class in isolation, and in conjunction with other associated classes. Test each class method, and test sequences of messages that class objects should respond to. May need stubs and/or test drivers. 34

Black-Box Class Testing (3) Group class objects into categories. Test each method for each category. A test plan documents all of the tests to be performed. 35

Testing Java Class String: Find String Objects to Test Find an ordering of the class objects: "", "a", "b",..., "aa", "ab",..., "zz...zz" Use the ordering to select test objects. 36

Use the Ordering to Select Test Cases Find objects at extremes and next to extremes: Minimum size: "", "a" Long strings: "zz...zz", "zz...zy" Middle length Strings. Different types of Strings: numbers control characters: "^D^C" symbols: "&$@+-> Invalid strings: a null String variable. For C++, you can set a String variable to an integer. 37

Ex: Testing Java Class Stack Stack method interface: boolean empty() Object peek() Object pop() void push(object element) int search(object element) This is non-stack type of operation!! Object Stack(): The default constructor. 38

Classify the Operations Constructors/Destructors: Stack() ~Stack() in C++ State changing operations: pop() push(object e) Non-state changing operations: empty() peek() 39

Test Each Type of Operation Constructors: test each constructor with all orderings of parameter boundary values. Destructors: test with each constructor. State changing operations: try to change the object state from every ``state'' to every other ``state''. Non-state changing operations: test on stacks in each ``state''. 40

State Really a group of related states. Example stack states: Empty stacks, Mid-size stacks, Just under the maximum size stack, Large or full stacks. 41

Testing Multiplicity Create several stacks and test, alternating between them. This will determine whether each stack object has an independent state (independent instance variables). 42

The Test Oracle How do you know if an item is successfully pushed onto a stack? Examine the behavior of the resulting stack after the push operation is performed. 43

Class Testing Plan Structure Class name. For each public method: Method name. For each test case for the method: A test ID. Test strategy: black-box (BB) or white-box (WB); Test of valid or invalid input? Test description. Verification: what are the expected outputs? How do you identify success or failure? 44

Class Stack BB Test Plan Constructor method Stack() tests: Test: Stack.Stack1 Strategy: Black Box, Valid. Description: Create a Stack. Verification: A stack object is created; a non-null Stack reference is returned. Test: Stack.Stack2 Strategy: Black Box, Valid. Description: Create many Stacks. Verification: Many stack objects are created; nonnull, not equal Stack references are returned. 45

Class Stack BB Test Plan (2) Method push(object e) tests: Test: Stack.push1 Strategy: Black Box, Valid Description: Push one item onto a Stack. Verification: The item is on the top of the stack and can be popped off. Test: Stack.push2 Strategy: Black Box, Valid Description: Push many items onto a Stack. Verification: The items can be popped off in reverse order. 46

Class Stack BB Test Plan (3) Method push(object e) tests: Test: Stack.push3 Strategy: Black Box, Valid Description: Push many items onto many Stacks. Verification: The correct items can be popped off each stack in reverse order. Test: Stack.push4 Strategy: Black Box, Valid Description: Push a null item onto a Stack. Verification: The null object can be popped off. 47

Class Stack BB Test Plan (4) Method push(object e) tests: Test: Stack.push5 Strategy: Black Box, Invalid Description: Push many items onto a null Stack. Verification: An exception is raised. Test: Stack.push6 Strategy: Black Box, Invalid Description: Push a null item onto a non-stack object. Verification: It won t compile in Java; An exception is raised in C++. 48

Class Stack BB Test Plan (5) Method pop() tests: Test: Stack.pop1 Strategy: Black Box, Valid Description: Pop 1 item from a Stack. Verification: The item can be popped off. Test: Stack.pop2 Strategy: Black Box, Valid Description: Pop many items from a Stack. Verification: The items can be popped off. 49

Class Stack BB Test Plan (6) Method pop() tests: Test: Stack.pop3 Strategy: Black Box, Valid Description: Pop 1 item from many Stacks. Verification: The item can be popped off in reverse order. Test: Stack.pop4 Strategy: Black Box, Valid Description: Pop a null item from a Stack. Verification: The item can be popped off. 50

Class Stack BB Test Plan (7) Method pop() tests: Test: Stack.pop5 Strategy: Black Box, Invalid Description: Pop a null Stack. Verification: An exception is raised. Test: Stack.pop6 Strategy: Black Box, Invalid Description: Pop a non- Stack object. Verification: Will not compile. Exception in C++ 51

Class Stack BB Test Plan (8) Method pop() tests: Test: Stack.pop7 Strategy: Black Box, Invalid Description: Pop an empty Stack. Verification: An exception is raised. Method empty() tests: Test: Stack.empty1 Strategy: Black Box Valid Description: Test a newly created Stack. Verification: Returns true. 52

Class Stack BB Test Plan (9) Method empty() tests: Test: Stack.empty2 Strategy: Black Box Valid Description: Test a Stack with a history of 1 push and 1 pop. Verification: Returns true. Test: Stack.empty3 Strategy: Black Box, Valid. Description: Test a Stack with many pushes, and an equal number of pops. Verification: Returns true. 53

Class Stack BB Test Plan (10) Method empty() tests: Test: Stack.empty4 Strategy: Black Box Valid Description: Test after a push-pop-push-pop sequence. Verification: Returns true. Test: Stack.empty5 Strategy: Black Box, Valid. Description: Test after 1 push. Verification: Returns false. 54

Class Stack BB Test Plan (11) Method empty() tests: Test: Stack.empty6 Strategy: Black Box Valid Description: Test after many pushes. Verification: Returns false. Test: Stack.empty7 Strategy: Black Box, Invalid. Description: Test a null Stack. Verification: Exception. 55

Class Stack BB Test Plan (12) Method empty() tests: Test: Stack.empty8 Strategy: Black Box Invalid Description: Test a non-stack. Verification: Won t compile in Java. Exception in C++. 56

Test Drivers Must be able to: Build the test cases. Log testing results. Make success or failure observable. Can be Hard-coded. Reads tests from a file. Interactive. Each test should run independently. 57

Example Class Test Driver public class StackTest { public static void main (String[] args) throws IOException{ /** We run the tests **/ push1(); push5(); // No crash after invalid test! push2(); push3(); push5(); } 58

Test Stack.push.1 Test Plan public static void push1() { System.out.println( "\n" + "Test StackPush1. Test Type: BB, Valid \n + " Description: Push 1 item onto a stack. \n + " Verification: Item is there and can be + popped off."); 59

Now Run Test Stack.push.1 try{ Stack s = new Stack(); String i1 = "Item 1"; s.push(i1); System.out.println("Testing Results: \n" + " Item i1: " + i1 +"\n" + " After s.push(i1); The top is: " + s.peek() + "\n" + " Is i1==s.pop()? " + (i1==s.pop())); } catch (Exception e){ System.out.println("Testing Results: Error. \n " + e); } } 60

Test Stack.push.2 Plan public static void push2() { System.out.println( "\n" + "Test Stack.push.2, Test Type: BB, Valid \n" + " Description: Push many items onto a stack. \n" + " Verification: Items can be popped off in reverse order."); 61

Now Run Test Stack.push.2 try{ Stack s = new Stack(); String i1 = "Item 1"; String i2 = "Item 2"; String i3 = "Item 3"; String i4 = "Item 4"; String i5 = "Item 5"; s.push(i1); s.push(i2); s.push(i3); s.push(i4); s.push(i5); 62

Completing Stack.test.2 System.out.println( "Testing Results: \n" + " After pushing items 1 through 5 onto Stack s, \n" + " we try to pop them off:"); for (int i=1; i<6; i++) System.out.println(" " + i + ". s.pop(): " + (s.pop())); } // end try 63

Catch Stack.test.2 Failures catch (Exception e){ System.out.println("Testing Results: + Error. \n " + e); } } 64

Test Stack.push.3 public static void push3(){ System.out.println( "\n" + "Test Stack.push.3, Test Type: BB, Valid \n" + " Description: Push many items onto many stacks. \n" + " Verification: Items can be popped off in reverse order."); 65

Run Test Stack.push.3 try{ Stack s1 = new Stack(); Stack s2 = new Stack(); Stack s3 = new Stack(); String i1 = "Item 1"; String i2 = "Item 2"; String i3 = "Item 3"; String i4 = "Item 4"; String i5 = "Item 5"; String i6 = "Item 6"; s1.push(i1); s2.push(i2); s3.push(i3); s3.push(i4); s2.push(i5); s1.push(i6); 66

More Test Stack.push.3 System.out.println( "Testing Results:\n" + " After pushing items 1 through 6 onto Stack s1, s2, s3, \n" + " we try to pop them off:"); System.out.println( " s1 has items pushed in order 1, 6"); for (int i=1; i<3; i++) System.out.println(" " + i + ". s1.pop(): " + (s1.pop())); System.out.println( " s2 has items pushed in order 2, 5"); for (int i=1; i<3; i++) System.out.println(" " + i + ". s2.pop(): " + (s2.pop())); 67

Complete Stack.push.3 System.out.println( " s3 has items pushed in order 3, 4"); for (int i=1; i<3; i++) System.out.println(" " + i + ". s3.pop(): " + (s3.pop())); } catch (Exception e){ System.out.println("Testing Results: Error. \n " + e); } } 68

Stack.push.5 public static void push5(){ System.out.println( "\n" + "Test Stack.push.5, Test Type: BB, Invalid \n" + " Description: Try to push onto a stack variable which \n" + " is not instantiated (a null stack).\n" + " Verification: Exception is raised."); 69

Run Stack.push.5 try{ Stack s = null; String theitem = "The Item"; s.push(theitem); System.out.println("Testing Results: \n" + " Item theitem: " + theitem +"\n" + " After s.push(i1); The top is: " + s.peek() + "\n" + " Is theitem==s.pop()? " + (theitem==s.pop())); } 70

Now We Really Catch an Exception catch (Exception e){ System.out.println("Testing Results Error. \n + e); } 71