Manuel Oriol, CHCRC-C, Software Testing ABB

Similar documents
Topics in Software Testing

Software Testing Interview Question and Answer

Software Testing. Software 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

CS 520 Theory and Practice of Software Engineering Fall 2018

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

C07: Testing and JUnit

10. Software Testing Fundamental Concepts

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

Lecture 15 Software Testing

INTRODUCTION TO SOFTWARE ENGINEERING

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

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

Software Quality Assurance. David Janzen

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

Software Engineering and Scientific Computing

Manual Testing. Software Development Life Cycle. Verification. Mobile Testing

Chapter 9 Quality and Change Management

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

Aerospace Software Engineering

Pearson Education 2007 Chapter 9 (RASD 3/e)

Software Engineering: Theory and Practice. Verification by Testing. Test Case Design. Tom Verhoeff

Chapter 8 Software Testing. Chapter 8 Software testing

Software Testing CS 408

Sample Exam Syllabus

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

Testing. UW CSE 160 Winter 2016

Software Testing Lecture 1. Justin Pearson

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

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

Testing: Test design and testing process

Sample Exam ISTQB Advanced Test Analyst Answer Rationale. Prepared By

MONIKA HEINER.

EECS 4313 Software Engineering Testing. Topic 01: Limits and objectives of software testing Zhen Ming (Jack) Jiang

Ingegneria del Software Corso di Laurea in Informatica per il Management

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

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

Introduction to Dynamic Analysis

Written exam TDDD04 Software Testing

Introduction To Software Testing. Brian Nielsen. Center of Embedded Software Systems Aalborg University, Denmark CSS

Simulink Verification and Validation

Programming Embedded Systems

Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the specified requirements or not.

Examination Questions Time allowed: 1 hour 15 minutes

Software Testing Strategies. Slides copyright 1996, 2001, 2005, 2009, 2014 by Roger S. Pressman. For non-profit educational use only

Certified Tester Foundation Level(CTFL)

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

Chapter 10. Testing and Quality Assurance

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

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

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

Part 5. Verification and Validation

People tell me that testing is

Chapter 9. Software Testing

Software Testing. Massimo Felici IF

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

linaye/gl.html

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

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

QUIZ #5 - Solutions (5pts each)

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

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

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

18-642: Unit Testing 1/31/ Philip Koopman

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence!

Testing & Debugging TB-1

Software Engineering I (02161)

Part I: Preliminaries 24

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

Utilizing Fast Testing to Transform Java Development into an Agile, Quick Release, Low Risk Process

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

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

Software Testing. Testing: Our Experiences

WHY TEST SOFTWARE?...

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

Chap 2. Introduction to Software Testing

Program Correctness and Efficiency. Chapter 2

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

Quality Assurance in Software Development

WHITE PAPER. 10 Reasons to Use Static Analysis for Embedded Software Development

Software Quality. Richard Harris

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

Agile Software Development. Lecture 7: Software Testing

Announcements. Testing. Announcements. Announcements

Advanced Software Engineering: Software Testing

Software Testing Prof. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur. Lecture 13 Path Testing

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

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

CS159. Nathan Sprague. September 30, 2015

Verification and Validation

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

Object Oriented Software Design - I

Software Testing: Introduction

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

An Introduction to Systematic Software Testing. Robert France CSU

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

Testing. Topics. Types of Testing. Types of Testing

Using Code Coverage to Improve the Reliability of Embedded Software. Whitepaper V

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

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

Transcription:

Manuel Oriol, CHCRC-C, 08.11.2017 Software Testing Slide 1

About me 1998 2004 2005 2008 2011 Slide 2

Introduction Why do we test? Did you have to deal with testing in the past? Slide 3

Ariane 5 http://www.youtube.com/watch?v=kyurqduyepi Slide 4

Ariane 5 Slide 5 http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=562936

We have been trained to make assumptions x*x=x 2 0 x+1>x false for x= 46341 (and many more int) false for x=max_int (x * y) / x = y false for x=0 or float x (y / x) * x = y false for x=0 or int, float x Slide 6

Typically impossible to Test all values (see modelchecking) Know what to omit when testing Know how to interpret results Slide 7

An example /* * A simple method that increments an integer value **/ int increment(int i){ } return i+1; Testing all values? What not to test? How to interpret results? Slide 8

In this case Test all values? It is possible! Know what to omit when testing? e.g. http://en.wikipedia.org/wiki/ Pentium_FDIV_bug Know how to interpret results? increment(integer.max_value)??? Slide 9

The famous quote on testing Program testing can be used to show the presence of bugs, but never to show their absence! Edsger W. Dijkstra http://en.wikiquote.org/wiki/edsger_w._dijkstra Referencing: Notes On Structured Programming, 1972, at the end of section 3, On The Reliability of Mechanisms. Slide 10

The usual trade-off Quality & Test Deadlines & Reputation Slide 11

Natural tendencies Testing is in the way to make deadlines Testing finds bugs that do not matter I have no time planned for the testing Come on, our code is good! The code I write is throw-away Slide 12

So why do we really test? We try to find bugs to fix them to improve the quality of the code! Slide 13

Testing saves time and finds bugs early With system-level testing without unit testing With system-level testing and unit testing 70 bugs 1 bug 16 weeks debugging time 50% less overall time 5%-30% of the time writing tests 5%-20% running tests Gail C. Murphy, Paul Townsend, and Pok Sze Wong. 1994. Experiences with cluster and class testing. Commun. ACM 37, 9, 39-47 Slide 14

So, should we just test, test, test? This would not solve the problem if testing is not planned and strategically applied! Testing techniques are numerous and give a very large panel of possibilities A software test engineer (or software tester) will know how to apply most and be able to discover/ adapt them to the software at hand. Slide 15

What makes a good tester? The will to spend time crashing programs A strong commitment to drive the code to the best level of compliance with specifications The will to drive quality of the code up The will to understand how a program works to find its limitations The will to use tools and techniques that test programs Slide 16

Some conventions IEEE terminology: When a program exhibits an unexpected behaviour, it is a FAILURE A failure is caused by a FAULT in the program A defect is caused by an ERROR or a MISTAKE made by a programmer ERROR causes FAULT causes FAILURE Source: IEEE standard 610.1 Slide 17

Outline Types of testing Testing scopes Testing Processes Testing Artifacts Testing Metrics Slide 18

Part I: Types of Testing Slide 19

Categories of Testing Black-box/white-box/grey-box Static/dynamic testing Functional/non-functional Slide 20

Black-box/White-Box/Grey-Box Black-Box testing: does not consider implementation details, only interfaces White-Box testing (glass-box, clearbox, transparent, structural): uses the actual implementation of the program to devise tests Grey-Box: Mixes both of them If the test engineer know some of the internal of the program, it uses those to design some of the tests, the rest uses black-box Slide 21

Dynamic/Static Testing Dynamic testing is when the environment executes code, for example: Automated testing Unit tests Static testing does not require to execute the program, for example: Walkthrough Reviews Inspections Static analysis Slide 22

Example of static Analysis tool: findbugs Slide 23 http://findbugs.sourceforge.net

Other examples: Structure 101, Understand, Klocwork Understand Slide 24

Functional/non-functional Testing Functional testing tests that the program provides a functionality (e.g. calculates a result, doing something ) Non-Functional testing tests non-functional properties (scalability, security, -ilities in general) Slide 25

Examples Stress-testing the Apache web-server Testing code that has been outsourced Testing the code of a satellite Testing the code running a cell phone Testing Microsoft Word Slide 26

Part II: Testing Scope Slide 27

Testing Scopes Unit Testing Integration Testing System Testing Acceptance Testing Regression Testing Slide 28

Unit Testing Testing small parts of the programs Typically the unit tests have an initialisation part and an assertion for testing the value that should be returned Program: int increment(int i){ return i+1; } Test Test: @Test public void test_1(){ } int j = 0; asserttrue(increment(j)==1); Slide 29

Integration Testing Typically grouping together all some units and testing them together using a black-box approach Three main approaches: Big Bang: Put everything together then test Top-down: Modules tested from the entry points and integrated progressively Bottom-up: Modules are progressively integrated and tested from the most elementary ones. Slide 30

System Testing Tests integrated systems Tests functional and non-functional requirements Trying to understand even expected non-explicit requirements Typically black-box testing Slide 31

Acceptance Testing Runs based on script Designed by domain experts (subject matter expert), performed by potential users Main intent is not to discover failing scenarios, it is to check that the product will work (and how well) in a production environment Slide 32

Example of acceptance testing: A/B Testing To compare two alternatives of a product and decide on the one to pick using a metric of success 50% of the traffic is version A and 50% on version B. Example: Slide 33 https://vwo.com/ab-testing/

Regression Testing The goal is to check that what used to work still does For example, test suites will be automatically executed to check that scenarios are working The scope itself can vary Slide 34

Example (1/2) //Version 0 int increment(int i){ } return i+1; Test @Test public void test_1(){ } int j = 0; asserttrue(increment(j)==1); Slide 35

Example (2/2) //Version 1 int increment(int i) throws Exception{ } if (i<integer.max_value) return i+1; else throw new ArithmeticException(); Test @Test public void test_1(){ } int j = 0; asserttrue(increment(j)==1); Slide 36

Regression Testing Tool: Junit (from Eclipse) Slide 37

Part III: Testing Processes Slide 38

Original waterfall model Testing? Winston Royce, 1970, source: wikipedia, waterfall model Slide 39

V-Model Testing Source: V-model, wikipedia Slide 40

Test-Driven Development K. Beck (2003), Source: Test-driven_development, wikipedia Slide 41

Extreme Programming http://www.extremeprogramming.org/introduction.html Slide 42

Integration testing or how to trust but verify Tests are going to be run on each commit (preferred) or nightly and reported to users Slide 43

Artifacts Requirements Analysis Test Planning Test development Test execution Test reporting Test Result Analysis Requirements Test Strategy Testbed Test procedures Test cases Bug reports Test report Faults prioritization Test Plan/Procedures Traceability Matrix Test scenarios Slide 44

Part IV: Testing Artifacts Slide 45

Test Case A test script that generally consists of a single step to test a program. Typically a test case will have a test oracle to decide whether is passes or fails Test cases generally include the following indications: Id Description Related requirements Category Author Status (pass/fail) Slide 46

Example Id: test_1 Description: a test to decide that checks increment with 0 Related Requirement: increment documentation Category: Functional, Unit Author: Manuel Status: Pass @Test public void test_1(){ } int j = 0; asserttrue(increment(j)==1); Slide 47

Test Oracle Typically a way of deciding whether a test case passes or fail Includes: Documentation Requirements Assertions Other means of calculating the result Slide 48

Test Suite A test suite is a (potentially large) collection of test cases Typically test cases can be grouped in categories The goal of a test suite is to permit be used for checking that a new functionality does not break the code, or that it provides what is needed Large test suites might not be testable all the time (needed to test only a subset) Test suites quality is difficult to define (e.g. see mutation testing) Slide 49

Test Data Values used during testing to test some functionality Typically stored in separate files Difficult to generate a good set of test data: it is often reused Slide 50

Part V: Testing Metrics Slide 51

Coverage The coverage is a measure of a percentage of a structure or a domain that a program, a test case, a test suite exercises Slide 52

Coverages Function coverage Statement coverage Branch coverage (also known as: Decision coverage) Path coverage Condition coverage MCDC Slide 53

Function Coverage The percentage of functions that were called by the test case Typically function coverage should be 100% Slide 54

Statement coverage Percentage of statements that were executed Slide 55

Example Coverage of the red path: 86% (6/7 statements) a:=1 b:=a+2 b>3 true false Result:=b Result:=a b:=a b:=a Slide 56

Decision Coverage Each time a program has a branching instruction (if, for, while ) this create two branches. Decision coverage is the percentage of these branches that were executed by a test suite. if Slide 57

Example Decision Coverage of the red branches: 50% a:=1 b:=a+2 If (b>3) true Result:=b false Result:=a b:=a b:=a Slide 58

Branch Coverage Each time one has a branching instruction (if, for, while ) this create two branches. Branch coverage is the percentage of the branches that were executed by a test suite. if Slide 59

Example Coverage of the red branches: 75% (3/4 branches) a:=1 b:=a+2 If (b>3) true Result:=b false Result:=a b:=a b:=a Slide 60

Path Coverage The percentage of different paths exercised by the tests (put in relation with cyclomatic complexity) if Slide 61

Example Coverage of the red path: 50% (1/2 paths) a:=1 b:=a+2 If (b>3) true Result:=b false Result:=a b:=a b:=a Slide 62

Condition Coverage Each time one has a branching instruction (if, for, while ) that contains one or several conditions, each condition s outcome (True or False) is a possibility Condition coverage is the percentage of these possibilities that were executed by a test suite. if (a b) Slide 63 100% obtained with (a,b) = (true, false) and (false,true)

Modified Condition/Decision Coverage Consists of: 100% branch coverage 100% condition coverage Each entry/exit point is exercised Each condition affects the behaviour independently if (a b) DO-178B, Software Considerations in Airborne Systems Slide 64 and Equipment Certification

Tools to calculate the coverage: Cobertura http://cobertura.sourceforge.net/ Slide 65

My advice Write tests as a part of the coding activity Not at the end, not at the beginning, rather per unit Write unit tests Use unit testing frameworks like JUnit Monitor decision coverage and try to get it close to 100% Write integration tests use scripts and specific tools like Selenium Run your tests continuously Use a continuous integration server like Jenkins Fix the bugs you find Slide 66

Conclusions Software testing is at the core of any quality assurance mechanism currently used This presentation only gives a high level understanding of the techniques used in testing there is far more to learn Slide 67

Some terms used in software testing Slide 68