10 Verification All changes in the code have to be verified –refactoring –actualization Essential difficulties –programmers very often produce imperfect.

Slides:



Advertisements
Similar presentations
Object Oriented Analysis And Design-IT0207 iiI Semester
Advertisements

Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
Test process essentials Riitta Viitamäki,
Verification and Validation
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Illinois Institute of Technology
SE 555 Software Requirements & Specification Requirements Validation.
Validating and Improving Test-Case Effectiveness Author: Yuri Chernak Presenter: Lam, Man Tat.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
5 Introduction to software change Software change (SC) is the process of adding new functionality to existing code Foundation of software evolution, servicing.
Outline Types of errors Component Testing Testing Strategy
Issues on Software Testing for Safety-Critical Real-Time Automation Systems Shahdat Hossain Troy Mockenhaupt.
Verification and Validation
Software System Integration
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Dillon: CSE470: QUALITY ASSURANCE1 Software Qualities Maintainer User Customer Good Documentation Readable Code Good Design Low Cost Portability Increased.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Slide 6.1 CHAPTER 6 TESTING. Slide 6.2 Overview l Quality issues l Nonexecution-based testing l Execution-based testing l What should be tested? l Testing.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
1 Software Testing (Part-II) Lecture Software Testing Software Testing is the process of finding the bugs in a software. It helps in Verifying and.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
TESTING.
Chapter 8: Systems analysis and design
Software Testing.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
Testing Basics of Testing Presented by: Vijay.C.G – Glister Tech.
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
Testing Workflow In the Unified Process and Agile/Scrum processes.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
Systems Life Cycle A2 Module Heathcote Ch.38.
This chapter is extracted from Sommerville’s slides. Textbook chapter
Historical Aspects Origin of software engineering –NATO study group coined the term in 1967 Software crisis –Low quality, schedule delay, and cost overrun.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Chapter 12: Software Inspection Omar Meqdadi SE 3860 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
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 Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
1 Software Testing Strategies: Approaches, Issues, Testing Tools.
© 2012 Václav Rajlich Software Engineering: The Current Practice Ch Conclusion of software change The last phase of software change The activities.
Dynamic Testing.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
This chapter is extracted from Sommerville’s slides. Textbook chapter 22 1 Chapter 8 Validation and Verification 1.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Lecturer: Eng. Mohamed Adam Isak PH.D Researcher in CS M.Sc. and B.Sc. of Information Technology Engineering, Lecturer in University of Somalia and Mogadishu.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Chapter 9 Testing the System 9.1 Principles of System Testing Focus A: The objective of unit and integration ensure the code implemented the design.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini XVII. Verification and Validation.
Software Testing.
CSC 480 Software Engineering
Chapter 9, Testing.
Chapter 8 – Software Testing
BASICS OF SOFTWARE TESTING Chapter 1. Topics to be covered 1. Humans and errors, 2. Testing and Debugging, 3. Software Quality- Correctness Reliability.
Some Important Techniques For Regression Testing That You Must Know.
Lecture 09:Software Testing
Testing and Test-Driven Development CSC 4700 Software Engineering
Chapter 10 – Software Testing
Baisc Of 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.
Chapter # 1 Overview of Software Quality Assurance
Chapter 7 Software Testing.
Presentation transcript:

10 Verification All changes in the code have to be verified –refactoring –actualization Essential difficulties –programmers very often produce imperfect work –defects are called “bugs” Verification finds bugs © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 10 Initiation Concept Location Impact Analysis Prefactoring Actualization Postfactoring Conclusion VERIFICATIONVERIFICATION 1

Verification techniques Many techniques of software verification have been researched and proposed Current practice –testing –code inspection © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 102

Testing Tests execute the program or its parts –specific input to the execution –compare the outputs of the execution with the previously specified outputs –report if there is a deviation Tests are usually organized into a test suite –several, often many, tests. © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 103

Incompleteness of the testing “Testing can demonstrate the presence of the bugs, but not their absence. “ No matter how much testing has been done, residual bugs still can hide in the code –they have not been revealed by any tests –no test suite can guarantee that the program runs without errors © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 104

Turing’s halting problem Theoretical reason for testing incompleteness It is theoretically impossible to create a perfect test suite The programmers have been trying to do the best under the circumstances –techniques of the testing cannot guarantee a complete correctness of software –well designed tests come close to be adequate © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 105

New vs. old code tests Tests of the new code –new tests must be written with the new code Testing of the old code –the tests make sure the old code is not broken by the change –regression tests –prevent regression of what was already functioning in the software. –Merriam Webster: “regression” = “a trend or shift toward a lower or less perfect state” © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 106

Variety of software testing Setting –programmer’s workspace –team’s configuration management Strategy –structural –unit –functional Functionality –old (regression testing) –new –Combined (system testing) © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 107

Acceptance tests Final functional test –both the new and the old functionality Done during the phase of change conclusion –test the complete functionality of the software –software stakeholders are able to asses the progress of the software project © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 108

Composition of the test suite Unit tests –test for a specific class Functional tests –test a specific functionality of the whole program user manual or graphics user interface guide the creation of the functional tests. all features that are available to the user should be tested Structural tests © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 109

Harness (scaffolding) Test drivers –implement the support for the tests Stubs –implement the replacement for missing classes and subsystems Environment simulation Harness = drivers + stubs + simulators –production code vs. harness –developers vs. testers © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1010

Harness and production code © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 10 Production code goes to the user Harness stays within the programming group Parallel evolution of both 11

Coverage We cannot guarantee a complete correctness of the code by testing We are going to guarantee that each unit of the tested code is executed at least once –this guarantees that at least some of the bugs are discovered in particular, the bugs that are brought up by this single execution of the unit. © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1012

Granularity of methods calcSubTotal(), calcTotal(), getPrice(), setPrice(double) –each of them executed at least once Seems like a crude approach –systematic –guarantees correctness better than random selection of tests © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1013

Statement coverage Guarantees that every statement of the program is executes at least once Minimal test suite does not have any redundant tests –tests that cover only statements that are already covered by other tests Minimal test suite efficiently accomplishes the coverage –preferred approach © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1014

Example read (x); read (y); if x > 0 then write ("1"); else write ("2"); end if; if y > 0 then write ("3"); else write ("4"); end if; { } –incomplete coverage –does not cover write (“2”) {,, } –complete coverage –not minimal – is redundant {, } –complete and minimal © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1015

Minimal complete test suite Easy to write the first test –no matter what it covers, it adds to the test suite coverage Increased number of tests –the statements not covered are fewer –it is increasingly hard to aim new tests at these remaining uncovered statements –increased coverage may not be economic 70% coverage is considered to be good © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1016

Unit testing Testing of individual modules –testing classes and methods Testing of the composite functionality –the class is being tested together will all classes that support it Testing local functionality © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1017

Testing driver © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1018

Testing driver example public class TestItem { Item testItem; public void testCalcSubTotal() { assert(testItem.calcSubTotal(2, 3) == 6); assert(testItem.calcSubTotal(10, 20)==30); } public void testCalcTotal() { assert(testItem.calcTotal(0, 5) == 5); assert(testItem.calcTotal(15, 25) == 40); } } ; © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1019

Testing local responsibility Driver + stub –stub simulates suppliers part of harness Reasons: supplier classes –are not available –have not been tested the confidence in them is low –support a limited contract (limited precondition) the tested class to be used with other suppliers © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1020

Stubbing techniques Less effective algorithm –easier to implement –test becomes less efficient developers do testing, acceptable impact Limited precondition of the stub –simplifies the code of the stub substantially convert the date into a day of the week –the stub does that only for a selected month inappropriate if the stubbing reason is to broaden the contract © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1021

Stubbing techniques, cont. User intervention –interrupts the test, the user provides the correct answer practical only in if the stub is executed only few times during the test human user may input incorrect values Replacement contract –quick but incorrect postcondition –the most controversial stubbing technique –still may provide valuable results © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1022

Functional testing Tests the functionality of the complete program Program with GUI: test every function –“tape recording” for future tests Coverage –percentage of the requirements tested © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1023

Regression Testing After change, programmers retest the code –reestablish the confidence that the old functionalities of the software still work –change may have inadvertently introduced stray bugs into the intact parts Tests from the past constitute the bulk of the regression test suite – test suite often grows – testing is often done overnight © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1024

Test suite evolution © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1025

Obsolete tests Broken test cases that cannot run –they do not interface with the software any more Tests that do not fulfill their purpose –a test case testing the limits of a range becomes obsolete when the range is changed Tests that no longer provide a deterministic result –a test case which may now impacted by the mouse © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1026

Code inspection Somebody else than the author reads the code –checks its correctness –reports bugs Code inspection does not require execution of a system –can be applied to incomplete code or to other artifacts models, documentation © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1027

Effectiveness of code inspection “Habituation” –people become blind to their own mistakes After reading the code several times –programmers no longer read the code recall from the memory what the code should contain some errors repeatedly escape their attention –a different reader spots these errors easily and right away © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1028

Inspections and testing are complementary Some bugs are easily found by testing –they appear in each test they are sometimes hard to spot by human example: misspellings of long identifiers Some bugs are hard to find by testing –it is hard to create a test that finds them human readers can find them easily example: a possible division by zero to create a test that causes such situation can be hard © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1029

Inspection of different artifacts Inspections can also check whether different artifacts agree with each other –does the code correspond to the change request? –does the UML model correspond to the actual code? Inspections cannot check non-functional characteristics –performance and usability © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1030

Walkthroughs Structured inspection process Walkthrough team –at least four members the author of the inspected code a moderator at least two code reviewers. © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1031

Walkthrough process Preparation –the code or other work products are distributed to inspection team –one participant (reader) is selected to inspect the document thoroughly Walkthrough meeting –all team members participate –whole group walks through the document under direction of the reader © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1032

Walkthrough meeting The reader notes the errors, omissions and inconsistencies in the code –the other members of the team add their own observations The moderator chairs the meeting –notes the discovered errors –produces a report recommendations, which documents have to be corrected or reworked © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 1033