Learning outcomes. Systems Engineering. Debugging Process. Debugging Process. Review

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

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

Static and dynamic Testing

ΗΜΥ 317 Τεχνολογία Υπολογισμού

Part 5. Verification and Validation

Verification and Validation

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

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

Lecture 15 Software Testing

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

Chapter 10. Testing and Quality Assurance

Verification and Validation

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

Chapter 9 Quality and Change Management

Pearson Education 2007 Chapter 9 (RASD 3/e)

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

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

Software Testing. Software Testing

CS314 Software Engineering Peer Reviews

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

Higher-order Testing. Stuart Anderson. Stuart Anderson Higher-order Testing c 2011

Verification and Validation

Chapter 8 Software Testing. Chapter 8 Software testing

Software Engineering (CSC 4350/6350) Rao Casturi

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

Software Engineering Fall 2014

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

Verification and Validation

Verification and Validation

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

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

SOFTWARE ENGINEERING SOFTWARE VERIFICATION AND VALIDATION. Saulius Ragaišis.

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

MONIKA HEINER.

Testing and Debugging

Lecture 9. Verification and Validation. Assuring that a software system meets a user's needs. Tutorial Questions. Verification and Validation

Darshan Institute of Engineering & Technology for Diploma Studies

Main concepts to be covered. Testing and Debugging. Code snippet of the day. Results. Testing Debugging Test automation Writing for maintainability

Program Correctness and Efficiency. Chapter 2

Verification, Testing, and Bugs

Verification and Validation

Aerospace Software Engineering

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

Examining the Code. [Reading assignment: Chapter 6, pp ]

Chapter 8. Achmad Benny Mutiara

Software Testing Interview Question and Answer

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

Chapter 8 Software Testing

Object Oriented Software Design - I

Software Development Fundamentals (SDF)

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

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

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

Review sheet for Final Exam (List of objectives for this course)

Software Quality Assurance. David Janzen

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

Course Wrap-Up. Software Testing and Verification. Stephen M. Thebaut, Ph.D. Prepared by. University of Florida

It is primarily checking of the code and/or manually reviewing the code or document to find errors This type of testing can be used by the developer

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

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

Testing Objectives. Successful testing: discovers previously unknown errors

Certified Tester Foundation Level(CTFL)

[IT6004-SOFTWARE TESTING] UNIT 2

Software Quality. Richard Harris

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

Chapter 9. Software Testing

Improving Software Testability

Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering. Sixth Semester

F. Tip and M. Weintraub FUNCTIONAL TESTING

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

Test design techniques

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

Chapter 8 Software Testing. Chapter 8 So-ware tes0ng

CSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 11 gdb and Debugging (Thanks to Hal Perkins)

Examination Questions Time allowed: 1 hour 15 minutes

Sample Question Paper. Software Testing (ETIT 414)

Agile Software Development. Lecture 7: Software Testing

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

Software testing. Objectives. Contents

Test-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University

CMSC 132: OBJECT-ORIENTED PROGRAMMING II

Cursul Aprilie

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

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

Guidelines for Writing C Code

WHY TEST SOFTWARE?...

Verification and Validation. Verification and validation

Topics in Software Testing

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

Software Engineering Testing and Debugging Debugging

Testing and Validation of Simulink Models with Reactis

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

Key Features. Defect Rates. Traditional Unit testing: 25 faults / KLOC System testing: 25 / KLOC Inspections: / KLOC

Today s Topic. Software Engineering Testing and Debugging Debugging. Today s Topic. The Main Steps in Systematic Debugging

SE310 Analysis and Design of Software

Software Applications What Are they? enterprise software accounting software office suites graphics software media players Databases Graphical user

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0.

Programming Embedded Systems

An Introduction to Systematic Software Testing. Robert France CSU

CSE 374 Programming Concepts & Tools

Transcription:

Systems Engineering Lecture 9 System Verification II Dr. Joanna Bryson Dr. Leon Watts University of Bath Department of Computer Science 1 Learning outcomes After both lectures and doing the reading, you should be able to: Explain the role & practice of debugging in the software process. Describe in detail the purpose, scope of, and activities comprising each of the three main phases of software testing. Conduct a software inspection / code review. Describe the components of a software test case and explain its connection with system requirements. 2 Debugging Process A typical debugging process when testing: Test results Locate error Specification Design for error repair Implement repair Test cases Re-test program Debugging Process Debugging, like programming, is an art learnt primarily through experience. Learn common errors and spot patterns. Interactive Development Environments (IDEs) help debugging. Access to symbol table in compiler. Allow developer to step through code Set breakpoints. Add variable watches. Review You should be able to do this in Eclipse. 3 4

Common Program Defects There are two classes of common defect: General issues, regardless of particular language, Program language specific. Over to you Can you think of any general errors you see (or make!) in programs time and time again? 5 General program defects (1) Data faults Variables initialised before they are used? All constants named? Bounds String delimiters Compound statements (scope) Control faults All cases accounted for in case constructs? Breaks if needed? Predicate logic on conditional statements. Compound statements (control). Exception management All possible (reasonable) error conditions handled? 6 General program defects (2) Interface faults Number/type/order of arguments match? Shared data structures. Memory Has enough (any?!) memory been allocated? (buffer overflow) Memory leaks (slows execution even if garbage collection). Stack overflow (end cases for recursion). Pointer arithmetic. 7 Error Seeding / Bebugging Intentionally introduce typical defects into the code. Seeded detected (SD) Unseeded detected (UD) = Seeded (S) Unseeded (U) Example: TD = total detected = (SD+UD) = 40 S = 100 (known) SD = 5 (how many seeded errors were found) U = estimated total unseeded = 100 ( 40-5) / 5 = 700 8 Review?

Defensive Programming Tests can be built into the code for execution at run-time. E.g. range checks, impossible default options for switch statements. Heavily used in safety critical systems to prevent unsafe values, e.g. high doses of radiation. Remember: not just checking for yourself, checking future modifications. These usually take the form of assertions assert(x<3) I assert x should be <3 at this point. If not (if a false assertion), then I throw a fatal error. Indicates system aborting is more desirable than the consequence of a value of x!3. 9 The Three Phases of software testing Each of the three main phases of testing vary in system and organisational scope. 1. Component (Unit) Tests Developer 2. Integration Tests Code maturity 10 3. System Acceptance Tests Independent team! test " test 1. JUnit Component public class MyTest extends TestCase { public void checksquare() { Squarer s=new Squarer(3); Assert.assertTrue(s.result==9); // assertequals(x,y) also used Java CASE tool that encourages test-first development. Often used in agile methods e.g. XP Creates test harness for units Assists unit and regression testing Define tests by extending TestCase 11 1. JUnit Component public class MyTest extends TestCase { public void checksquare() { Squarer s=new Squarer(3); Assert.assertTrue(s.result==9); // assertequals(x,y) also used public static Test suite() { TestSuite suite=new TestSuite(); suite.addtest(new MyTest( checksquare() ;... return suite; Specify a test harness as a suite 12

1. JUnit Whitebox Testing Tips Specify a test harness as a suite Suite runs in JUnit GUI. Good practice Re-run your tests at least once a day during development e.g. lunch. Keep updating your TestCase(s) as you develop. Image: sourceforge.net Component Test against subsystem functional specification. Typical defect tests would include code centred: Equivalence partition / boundary checks Tests of branches Tests of conditions Concurrency/timing and contended resource issues 13 14 2. Bottom-up integration & testing Benefits: No stubs needed. Provides early integration of units. Overall structural design can evolve until a late stage. Problems: Integration Need an initial fully decomposed design to start (testing and design cannot overlap initially). 2. Top-down integration & testing Achieved by stubbing out lower functions. Gives a good progress indication of overall functionality. Many stubs need to be written. Stubbing may be seen as expensive for large projects. Benefits may outweigh the costs. Stubs can be seen as specifications. 15 16

iii. Regression testing When new components are integrated... We must test their integration with connected units, but must also ensure the existing inter-operation of units is not damaged....therefore we employ regression testing. Automation is necessary on medium to large scale projects. 17 3. Release / Acceptance Testing Testing the system as a functioning entity that might be delivered to the customer. Black box testing. Based on both Functional & Non-Functional Requirements. Typically test cases will include: Scenarios / Use-case-based tests Equivalence partitioning. Boundary value testing. Walking the state transition table. Stress testing and other external measures. Acceptance The Three Phases of software testing Software Inspections Each of the three main phases of testing vary in system and organisational scope. 1. Component (Unit) Tests Developer 2. Integration Tests Code maturity 19 3. System Acceptance Tests Independent team! test " test Systematic review of software documentation Usually program code, but possible with any readable system documentation. Performed in the setting of a group meeting. There are 3 significant advantages to inspections: Program need not be complete in order to inspect. One error can mask others at run-time. Because inspection is static, this is not an issue and more errors may be picked up. Can consider broader issues e.g. coding standards, portability, maintainability. 20

How to run a Software Inspection Create checklist before meeting. System overview presented to inspection team at a meeting. (500 statements/hour) Code / documentation distributed to inspection team in advance. (150 statements/hour) Inspection takes place in group meeting. Errors are noted. (100-150 statements/hour) Code / documentation modified (debugged). Roles in a Software Inspection Reader Presents code to the meeting, sometimes stepping through lines. Inspector Spots the errors, or noncompliances with broader issues such as standards. Author / Owner Responsible for producing the code or document being reviewed. Scribe Records results of inspection meeting. Chairman / Moderator Responsible for running inspection. Chief moderator Reflects on / improves inspection process itself QA Re-inspect? (decision based on V&V budget) 21 22 Features of Software Inspections Formal methods may be used for rigorous software inspections e.g. Cleanroom. Informal methods tend to focus on: Defect detection, Poor programming style, Standards conformance. Informal inspections can detect up to 60% of defects [Fagan 86]. When applying formal methods, this can rise to 90% [Mills et al. 97]. Particularly valuable for loose-typed languages such as C. Less useful for languages like Java as compiler does more of the work. They are expensive, and become cost effective only when inspection teams are experienced. 23 Effective Testing in the V-Model Joined-up Thinking about Validation and Verification: Test Cases Requirements specification Architectural design Low-level design Plan Plan Plan Implementation & Verification Unit test 24 Integration test Acceptance/ release test Test case Use case Test Planning Scenario

How to Design Test Cases Writing Effective Test Cases What is a test case? A set of inputs and predicted outputs that are effective in discovering program defects and showing the system meets its requirements. Three approaches to designing test cases Requirement based Partition based equivalence partition Structure / path based Exhaustive testing of a system is impossible in all but the simplest cases. Recall: fitness for purpose. 25 Increasingly low-level A test case should contain: 1. a clear statement of its objective, joined up with other development documents, especially requirements. 2. test case name (meaningful title). 3. test case identifier (unique code number). 4. description of the test conditions/setup. 5. input data requirements. 6. the steps to be performed with the test setup. 7. the results of the test that are expected, if all is working properly. 26 Summary After both lectures and doing the reading, you should be able to: Explain the role & practice of debugging in the software process. Describe in detail the purpose, scope of, and activities comprising each of the three main phases of software testing. Conduct a software inspection / code review. Describe the components of a software test case and explain its connection with system requirements. 27