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

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

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

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013!

Lecture 15 Software Testing

Chapter 10. Testing and Quality Assurance

Levels of Testing Testing Methods Test Driven Development JUnit. Testing. ENGI 5895: Software Design. Andrew Vardy

Levels of Testing Testing Methods Test Driven Development JUnit. Testing. ENGI 5895: Software Design. Andrew Vardy

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

Ingegneria del Software Corso di Laurea in Informatica per il Management

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

10. Software Testing Fundamental Concepts

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

Exam in Testing. Justin Pearson. Dec Cover Sheet. Problem no. Solution provided Max Your points Total: 59

Topics in Software Testing

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

Why testing and analysis. Software Testing. A framework for software testing. Outline. Software Qualities. Dependability Properties

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

Testing. CMSC 433 Programming Language Technologies and Paradigms Spring A Real Testing Example. Example (Black Box)?

Analysis of the Test Driven Development by Example

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

Unit Testing and JUnit

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

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

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

Object Oriented Software Design - I

Chapter 8 Software Testing. Chapter 8 Software testing

Software Testing CS 408

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

Part 5. Verification and Validation

F. Tip and M. Weintraub FUNCTIONAL TESTING

Aerospace Software Engineering

Software Testing. Software Testing

Software Engineering

Software Testing Interview Question and Answer

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

Darshan Institute of Engineering & Technology for Diploma Studies

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

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

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

Test Case Generation Based on Sequence Diagrams

LECTURE 8 TEST DESIGN TECHNIQUES - I

Programming Embedded Systems

Quote by Bruce Sterling, from: A Software Testing Primer, Nick Jenkins

Outline. software testing: search bugs black-box and white-box testing static and dynamic testing

Computational Systems COMP1209

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Modern Methods in Software Engineering. Testing.

Lecture 21. Regression Testing Path Spectra. EE 382V Spring 2009 Software Evolution - Instructor Miryung Kim

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

Software Engineering Theory. Lena Buffoni (slides by Kristian Sandahl/Mariam Kamkar) Department of Computer and Information Science

Software Engineering and Scientific Computing

Software Testing. Testing: Our Experiences

Test suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (testing whatever occurs to you at

CS18000: Programming I

QUIZ #5 - Solutions (5pts each)

Chapter 9. Software Testing

An Introduction to Systematic Software Testing. Robert France CSU

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

Regression testing. Whenever you find a bug. Why is this a good idea?

Unit Testing with JUnit and CppUnit

Unit Testing and Test Driven Design

International Journal of Computer Engineering and Applications, Volume XII, Special Issue, September 18, ISSN SOFTWARE TESTING

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

Software Engineering Testing and Debugging Testing

Design and Synthesis for Test

Software Engineering

Verification and Validation. Verification and validation

UNIT-4 Black Box & White Box Testing

Testing. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 13

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

Software Test. Levels of test. Types of test. Regression test The JUnit tool for unit testing Java programs. System test Integration test Unit test

Black-box Testing Techniques

CS 424 Software Quality Assurance & Testing LECTURE 3 BASIC CONCEPTS OF SOFTWARE TESTING - I

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

BDD and Testing. User requirements and testing are tightly coupled

International Journal of Computer Engineering and Applications, Volume XII, Special Issue, April- ICITDA 18,

People tell me that testing is

Agile Software Development. Lecture 7: Software Testing

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 15 Testing

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

UNIT-4 Black Box & White Box Testing

Want Better Software? TEST it! (and thenwrite it) Tame defects before they appear You Rise/Bugs Fall

Testing for the Unexpected

Shree.Datta Polytechnic College,Dattanagar, Shirol. Class Test- I

Testing & Debugging TB-1

The testing process. Component testing. System testing

Program Correctness and Efficiency. Chapter 2

Software processes, quality, and standards White-box testing

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

Topics. Software Testing Test Driven Development Black Box Testing Unit Testing White Box Testing Coverage Testing Software Debugging

Manuel Oriol, CHCRC-C, Software Testing ABB

Software Quality Assurance. David Janzen

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

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

Test Automation. Fundamentals. Mikó Szilárd

Test automation Test automation / JUnit

PES INSTITUTE OF TECHNOLOGY- BANGALORE SOUTH CAMPUS

Input Space Partitioning

What's that? Why? Is one "better" than the other? Terminology. Comparison. Loop testing. Some experts (e.g. Pezze & Young) call it structural testing

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

Transcription:

Black Box Testing EEC 521: Software Engineering Software Testing Black-Box Testing Test-Driven Development Also known as specification-based testing Tester has access only to running code and the specification it is supposed to satisfy Test cases are written with no knowledge of internal workings of the code Focus is on ensuring that contract is met, and all legal invocations are handled correctly 11/12/09 EEC 521: Software Engineering 1 11/12/09 EEC 521: Software Engineering 2 Specification-Based Testing Specification Operation op Pre: X Post: Y Specification- Based Test Case Design Test Case 1 Input: x1 (sat. X) Exp. Output: y1 Test Case 2 Input: x2 (sat. X) Exp. Output: y2 No Source Code No access to source code So test cases don t worry about structure Emphasis is only on ensuring that the contract is met 11/12/09 EEC 521: Software Engineering 3 11/12/09 EEC 521: Software Engineering 4

Advantages Scalable; not dependent on size of code Testing needs no knowledge of implementation Tester and developer can be truly independent of each other Tests are done with requirements in mind Does not pardon inconsistencies in the spec Test cases can be developed in parallel with code Disadvantages Test size will have to be small Specs must be clear, concise, and correct May leave many program paths untested Weighting of program paths is not possible Lot more research on white-box testing 11/12/09 EEC 521: Software Engineering 5 11/12/09 EEC 521: Software Engineering 6 Test Case Design Examine pre-condition, and identify equivalence classes Enumerate possible inputs such that all classes are covered Apply the specification to input to write down expected output Equivalence Partitioning Input data for a program unit usually falls into a number of partitions e.g. all negative integers, zero, all positive numbers Each partition of input data makes the program behave in a similar way Two test cases based on members from the same partition is likely to reveal the same bugs By identifying and testing one member of each partition we gain 'good' coverage with 'small' number of test cases Testing one member of a partition should be as good as testing any member of the partition 11/12/09 EEC 521: Software Engineering 7 11/12/09 EEC 521: Software Engineering 8

Equivalence Partitioning Boundary Value Analysis Example: for binary search the following partitions exist Inputs that conform to pre-conditions Inputs where the precondition is false Inputs where the key element is a member of the array Inputs where the key element is not a member of the array Pick specific conditions of the array The array has a single value Array length is even Array length is odd 11/12/09 EEC 521: Software Engineering 9 Arises from the fact that most program fail at input boundaries Suppose system asks for a number between 100 and 999 inclusive The boundaries are 100 and 999 We therefore test for values 99 100 101 Lower boundary 998 999 1000 upper boundary 11/12/09 EEC 521: Software Engineering 10 Example Test case 1: // Sequence public void Add(int pos, int item) /* Requires 0 <= pos <= self Ensures there exists a, b: String : #Self = a*b and a = pos and Self = a * <item> * b */ Input: s = <1, 1, 2, 5>, pos = 3, item = 3 Satisfies precondition: 0 <= pos <= s Expected output: s = <1, 1, 2, 3, 5> Generating Test Cases for a Complete System Simple brute force generation of test cases is sub-optimal How do you know you have enough? How do you know if you re doing too much? 11/12/09 EEC 521: Software Engineering 11 11/12/09 EEC 521: Software Engineering 12

A Systematic Approach Modeling approach can vary Test case generation can be automated in some cases Independently Testable Features Different test cases for different features Simplifies test generation Simplifies fault location Here s where modular design specs really help But the lines of modularity will be different Will generally include several units 11/12/09 EEC 521: Software Engineering 13 11/12/09 EEC 521: Software Engineering 14 Modeling and/or Representative Values If the spec is model-based, this is a trivial step Use equivalence partitioning in identifying representative values Two extremes Directly enumerating rep values based on informal spec Formal model that describes rep values based on properties Test Case Spec Generation Suitably combining values for all inputs of the functional unit under test Cartesian product of enumerated values Combining properties of formal models Brute force ain t gonna work Five inputs, six values each 6 5 = 7776 11/12/09 EEC 521: Software Engineering 15 11/12/09 EEC 521: Software Engineering 16

xunit: Unit Testing Frameworks Several tools exist for behavioral testing Junit is one such - for unit testing Java programs Automatically generates stubs for methods you want to test Tester can then write test cases, and execute them 11/12/09 EEC 521: Software Engineering 17 Test-Driven Development Test first strategy Test cases are written by the programmer Test cases are written as executable Java-code Test cases can be invoked by a single command All test cases should be 100% OK, before a change can be considered done The concept has been implemented in many languages Test cases from different sources can be combined 11/12/09 EEC 521: Software Engineering 18 TDD with xunit Keep the Bar Green! 11/12/09 EEC 521: Software Engineering 19 11/12/09 EEC 521: Software Engineering 20

Keep the Bar Green! Advantages of TDD Take small steps when writing software Producing test cases on-the-fly Produce documentation on the fly Writing test cases early forces loosely-coupled design The act of writing a unit test is more an act of design than of verification. It is also more an act of documentation than of verification. The act of writing a unit test closes a remarkable number of feedback loops, the least of which is the one pertaining to verification of function [Martin, Newkirk, and Koss, 2003] 11/12/09 EEC 521: Software Engineering 21 11/12/09 EEC 521: Software Engineering 22 TDD: Test, Early, Often, and Automated TDD: Code and Test in Either Order Analysis Design Code Tests Verification Defects Testing Analysis Design Code Tests Verification 11/12/09 EEC 521: Software Engineering 23 11/12/09 EEC 521: Software Engineering 24

TDD and XP TDD is an integral part of Extreme Programming XP requires the creation of Test Plan along with code Main form of documentation Ten-Minute Build Continuous Integration 11/12/09 EEC 521: Software Engineering 25