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

Similar documents
Chapter 8 Software Testing. Chapter 8 Software testing

Chapter 8 Software Testing. Chapter 8 So-ware tes0ng

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

Chapter 8 Software Testing

Lecture 15 Software Testing

The testing process. Component testing. System testing

Software testing. Objectives. Contents

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

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

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

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

Part 5. Verification and Validation

Software Engineering I. Chapters 8 & 9. SW Testing & Maintenance. Slide 1. 12/17/2017 SW Testing and Maintenance

Software Engineering

W.C.Uduwela. Dept. of Mathematics & Computer Science

Recap on SDLC Phases & Artefacts. Topic: Software Verification, Validation and Testing Software Engineering

Chapter 9. Software Testing

Topics in Software Testing

Software LEIC/LETI. Lecture 18

Ch 4: Requirements Engineering. What are requirements?

Aerospace Software Engineering

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

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

Software Testing. Software Testing

Software Testing. Massimo Felici IF

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

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

Verification and Validation. Verification and validation

Verification and Validation

Requirements engineering

Ingegneria del Software Corso di Laurea in Informatica per il Management

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

Testing & Debugging TB-1

Sample Exam Syllabus

Chapter 9 Quality and Change Management

MONIKA HEINER.

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

Software testing A.A. 2018/2019

Pearson Education 2007 Chapter 9 (RASD 3/e)

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

Darshan Institute of Engineering & Technology for Diploma Studies

Software Engineering (CSC 4350/6350) Rao Casturi

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

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

2. SYSTEM MODELS, DESIGN AND IMPLEMENTATION

Design and Implementa3on

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

Write perfect C code to solve the three problems below.

Testing Theory. Agenda - What will you learn today? A Software Life-cycle Model Which part will we talk about today? Theory Lecture Plan

All the subjective part of 2011 papers solved complete reference numbers

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

Verification and Validation

The Importance of Test

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

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

Verification and Validation

Object-Oriented Design (OOD) Case Study : Architecture and Detail Design and Software Design Document (SDD) Prepared by Shahliza Abd Halim

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

INTRODUCTION TO SOFTWARE ENGINEERING

Chapter 10. Testing and Quality Assurance

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

An Introduction to Systematic Software Testing. Robert France CSU

Programming Embedded Systems

Software Engineering Testing and Debugging Testing

Testing Objectives. Successful testing: discovers previously unknown errors

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

Testing. Topics. Types of Testing. Types of Testing

Requirements Engineering: Specification & Validation. Software Requirements and Design CITS 4401 Lecture 18

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

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

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

The requirements engineering process

Examination Questions Time allowed: 1 hour 15 minutes

Software Engineering Fall 2014

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

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

Software Engineering

Bridge Course On Software Testing

SOFTWARE ENGINEERING IT 0301 Semester V B.Nithya,G.Lakshmi Priya Asst Professor SRM University, Kattankulathur

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

Software Testing. An Overview

Manuel Oriol, CHCRC-C, Software Testing ABB

CS159. Nathan Sprague. September 30, 2015

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

Introduction to Software Engineering

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

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

Software Testing. Hans-Petter Halvorsen, M.Sc.

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

People tell me that testing is

Types of Software Testing: Different Testing Types with Details

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

Chapter 15. Software Testing The assert Statement

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

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

Software Quality Assurance & Testing

Software Testing CS 408

Pearson Education 2005 Chapter 9 (Maciaszek - RASD 2/e) 2

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

Quality Assurance = Testing? SOFTWARE QUALITY ASSURANCE. Meaning of Quality. How would you define software quality? Common Measures.

Transcription:

Software Testing in the textbook Software Testing Chapter 8 Introduction (Verification and Validation) 8.1 Development testing 8.2 Test-driven development 8.3 Release testing 8.4 User testing 1 2 Verification and Validation Verification: - The software should conform to its specification (functional and non-functional requirements). "Are we building the product right. Validation: - The software should do what the customer really requires. Verification and Validation: Goals Establish confidence that the software is fit for purpose. NOT that it s completely free of defects. - generally not an achievable goal Good enough for its intended use - the type of use will determine the degree of confidence that is needed "Are we building the right product. Requirements don t always reflect real wishes and needs of customers and users 3 4

Verification and Validation: confidence level Required confidence level depends on: Software purpose - how critical is the software to an organization? User expectations - Users may have low expectations of certain kinds of software. Marketing environment - Getting a product to market early may be more important than finding all the defects in the program. 5 Verification Techniques Software inspections (static verification) - Analyze static system representation to discover problems - Specifications, design models, source code, test plans Software testing (dynamic verification) - The system is executed with simulated test data - Check results for errors, anomalies, data regarding nonfunctional requirements. 6 Verification Techniques Software Testing Goals Requirements specification System prototype Software architecture Inspections UML design models Database schemas V&V at different stages in the software process Program Testing Demonstrate that the software meets its requirements. - Validation testing - Collect test cases that show that the system operates as intended. Discover situations in which the behavior of the software is incorrect or undesirable. - Defect testing - Create test cases that make the system perform incorrectly. - Then fix the defect: Debugging 7 8

Software Testing Software testing process Input test data Ie Inputs causing anomalous behaviour Test cases Test data Test results Test reports System Design test cases Prepare test data Run program with test data Compare results to test cases Output test results Oe Outputs which reveal the presence of defects Test Case specifies: what to test input data expected output Can be automated Validation testing (white only) versus Defect testing (blue) 9 10 Three stages of software testing 8.1 Development testing: - the system is tested during development to discover bugs and defects. 8.3 Release testing: - a separate testing team tests a complete version of the system before it is released to users. 8.4 User testing: - users or potential users of a system test the system in their own environment. 8.1 Development testing All testing activities carried out by the team developing the system. (defect testing) - Unit testing: individual program units or object classes are tested. --should focus on testing the functionality of objects. - Component testing: several individual units are integrated to create composite components. --should focus on testing component interfaces. - System testing: some or all of the components in a system are integrated and the system is tested as a whole. --should focus on testing component interactions. 11 12

8.1.1 Unit testing Writing test cases for WeatherStation Unit testing is the process of testing individual components in isolation. - functions vs classes Goal: complete test coverage of a class: - Testing all operations associated with an object - Setting and interrogating all object attributes - Exercising the object in all possible states 1. Write a test case to check if identifier is set properly during normal system startup 2. Write test cases for each of the methods (reportweather(), etc.) Try to test in isolation, but for example you cannot test shutdown unless you have already executed restart. identifier WeatherStation reportweather ( ) reportstatus ( ) powersave (instruments) remotecontrol (commands) reconfigure (commands) restart (instruments) shutdown (instruments) 13 14 Testing the states of an object Use the state model: - Identify sequences of state transitions to be tested - Write a test case that generates the event sequences to cause these transitions. - Verify that the program ends up in the proper state. For example (for WeatherStation): - Shutdown -> Running-> Shutdown - Configuring-> Running-> Testing -> Transmitting -> Running - Running-> Collecting-> Running-> Summarizing -> Transmitting -> Running 15 shutdown() Testing States remotecontrol() reportstatus() restart() Shutdown Running Testing reconfigure() powersave() Configuring Operation configuration done clock Collecting Controlled collection done Shutdown -> Running-> Shutdown is tested with a call to restart() followed by a call to shutdown(), then check the state 16 transmission done Summarizing reportweather() Transmitting test complete weather summary complete

Automated unit testing Unit testing should be automated so that tests are run and checked without manual intervention. JUnit: a unit testing framework for the Java programming language. - Your test classes extend the JUnit test class: - Initialize the test case with the inputs and expected outputs. - Call the method to be tested. - Make the assertion: compare the result of the call with the expected result. - When executed, if the assertion evaluates to true, the test has been successful if false, then it has failed. 17 Sample JUnit style test case (from ch. 3) public class MoneyTest extends TestCase { } public void testsimpleadd() { Money m1 = new Money(12, usd ); Money m2 = new Money (14, usd ); Money expected = new Money(26, usd ); Money result = m1.add(m2); assertequals (expected, result); } 18 8.1.2 Choosing unit test cases Two types of unit test cases: those that show the component behaves correctly under normal use - For example, demonstrate (part of) a use case those that expose the defects/bugs - For example, invalid input should generate error message and fail gracefully Two strategies for choosing unit test cases Partition testing: identify groups of inputs that have common characteristics and should be processed in the same way. - choose tests from within each of these groups. Guideline-based testing: use testing guidelines based on the kinds of errors that programmers often make. - choose tests based on these guidelines. 19 20

Partition testing Divide the input data of a software unit into partitions of data - program should behave similarly for all data in a given partition Determine partitions from specifications Design test cases to cover each partition at least once. If the partition is a range, also test boundary values. Enables good test coverage with fewer test cases. 21 Equivalence partitions example 9999 10000 50000 Less than 10000 Between 10000 and 99999 More than 99999 Input values 3 4 7 Less than 4 Between 4 and 10 More than 10 Number of input values 22 11 10 100000 99999 Specification states the program accepts 4 to 10 inputs which are five-digit integers (greater than 10,000) Guideline-based testing Choose test cases based on previous experience of common programming errors For example: - Choose inputs that force the system to generate all error messages - Repeat the same input or series of inputs numerous times - Try to force invalid outputs to be generated - Force computation results to be too large or too small. - Test sequences/lists using one element zero elements different sizes in different tests 8.1.3 Component testing Software components are made up of several interacting objects (or sub-components) The functionality of these objects is accessed through the defined component interface. Component testing is demonstrating that the component interface behaves according to its specification. - Assuming the subcomponents (objects) have already been unit-tested 23 24

Interface (component) testing 8.1.4 System testing A Test cases C B System testing: integrating components to create a version of the system and then testing the integrated system. Checks that: - components are compatible, - components interact correctly - components transfer the right data at the right time across their interfaces. Tests the interactions between components. Small empty boxes represent the interface 25 26 Use case-based testing Use cases developed during requirements engineering to identify system interactions are a good basis for system testing. - typically each use case is implemented by several components in the system. reportweather sequence diagram Weather information system request (report) acknowledge SatComms reportweather () acknowledge WeatherStation get (summary) Commslink summarise () WeatherData If you developed sequence diagrams for the use cases, you can see the components and interactions that are being tested. reply (report) acknowledge send (report) acknowledge Use the diagram to identify operations that will be tested, and to help design test cases to execute the tests. 27 28

System testing policies Exhaustive system testing is impossible Testing policies define the required subset of all possible test cases, for an organization. Examples of testing policies: - All system functions that are accessed through menus should be tested. - Combinations of functions that are accessed through the same menu must be tested. - Where user input is provided, all functions must be tested with both correct and incorrect input. 8.3 Release testing Release Testing is testing a particular release of a system that is intended for use outside of the development team. Primary goal: convince the supplier of the system that it is good enough for use. Similar to system testing, but - Tested by a team other than developers. - Focus is on regular use (not defects). Usually a black-box testing process where tests are derived only from the system specification. 29 30 Two strategies for developing release test cases Requirements-based testing: examine each requirement in the SRS and develop one or more tests for it. - good requirements are verifiable. Scenario testing: use scenarios (user stories) developed during requirements engineering to develop test cases. 8.3.1 Requirements-based testing example Example requirements from MHC-PMS system: 1. If a patient is known to be allergic to any particular medication, then prescription of that medication shall result in a warning message being issued to the system user. 2. If a prescriber chooses to ignore an allergy warning, they shall provide a reason why this has been ignored. 31 32

Some tests developed to test the previous requirement 1. Set up a patient record with no known allergies. Prescribe medication for allergies that are known to exist. Check that a warning message is not issued by the system. 2. Set up a patient record with a known allergy. Prescribe the medication to that the patient is allergic to, and check that the warning is issued by the system. 3. Prescribe a drug that issues a warning and overrule (ignore) that warning. Check that the system requires the user to provide information explaining why the warning was overruled. 8.3.2 Scenario testing A scenario is a story that describes one way in which the system might be used - Longer than an interaction, may be several interactions - May have scenarios that were used during requirements engineering. To use a scenario for release testing: - tester assumes role of user, acting out scenario - may make deliberate mistakes - takes note of problems (slow response, etc.) Tests several requirements at once, in combination. 33 34 Scenario from MHC-PMS Kate is a nurse who specializes in mental health care. One of her responsibilities is to visit patients at home to check that their treatment is effective and that they are not suffering from medication side-effects. On a day for home visits, Kate logs into the MHC-PMS and uses it to print her schedule of home visits for that day, along with summary information about the patients to be visited. She requests that the records for these patients be downloaded to her laptop. She is prompted for her key phrase to encrypt the records on the laptop. One of the patients that she visits is Jim, who is being treated with medication for depression. Jim feels that the medication is helping him but believes that it has the side-effect of keeping him awake at night. Kate looks up Jim s record and is prompted for her key phrase to decrypt the record. She checks the drug prescribed and queries its side effects. Sleeplessness is a known side effect so she notes the problem in Jim s record and suggests that he visits the clinic to have his medication changed. He agrees so Kate enters a prompt to call him when she gets back to the clinic to make an appointment with a physician. She ends the consultation and the system re-encrypts Jim s record. After finishing her consultations, Kate returns to the clinic and uploads the records of patients visited to the database. The system generates a call list of those patients who she has to contact for follow-up information and make clinic appointments. 35 Features tested by this scenario 1. Authentication by logging on to the system. 2. Downloading and uploading of specified patient records to a laptop. 3. Home visit scheduling. 4. Encryption and decryption of patient records on a mobile device. 5. Record retrieval and modification. 6. Links with the drugs database that maintains sideeffect information. 7. The system for call prompting. 36

8.3.3 Performance testing Performance testing is designing and running tests to show the system can process its intended load. For validation of requirements: Use a typical operational profile: a set of tests that reflect the actual mix of work that will be handled by the system. Stress testing is a form of performance testing where the system is deliberately overloaded to test its failure behavior. - The load is steadily increased until the system performance becomes unacceptable. - Stress testing often required for distributed systems. 8.4 User testing Users or customers provide input and advice on system testing. - formal process where user tests a custom system or - informal process where user experiments with system User testing is essential, even when comprehensive system and release testing have been carried out. - Influences from the user s working environment have a major effect on the reliability, performance, usability and robustness of a system. - These cannot be replicated in a testing environment. 37 38 Types of user testing Alpha testing - Users of the software work with the development team to test the software at the developer s site. - custom software Beta testing - A release of the software is made available to users to allow them to experiment and to report problems - usually generic software Acceptance testing - Customers test a system to decide whether or not it is ready to be accepted from the system developers. - acceptance implies payment is due, may require negotiation. - custom software. 8.2 Test-driven development (in one slide) Test-driven development: - It is an approach to program development (not testing) in which you inter-leave testing and code development. - Tests are written before code, in small increments. - Don t move on to the next increment until the code that you have developed passes its test. Regression testing: - is rerunning previously-completed tests to check whether program behavior has changed. - In test-driven development, a regression test suite is developed incrementally as a program is developed. - Run these after each change, to make sure nothing got broken 39 40