Automatic Testing with Formal Methods

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

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

Towards Compositional Testing of Real-Time Systems

Testing of software and of communication systems. Richard Castanet, Bordeaux

Improvements on the Online Testing with T-UppAal: Coverage Measurement and Re-runs

Software Testing IV. Prof. Dr. Holger Schlingloff. Humboldt-Universität zu Berlin

Model-Based Testing. The Next Step in Test Automation!? Jan Tretmans SUT. model. TorXakis. SUMBAT: SUpersizing. Model.

Programming Embedded Systems

Model-Based Testing. with TorXakis. TestNet WerkGroep Model-Based testing. Jan Tretmans Piërre van de Laar. model. TorXakis.

Specification-based testing of IPsec

An approach for testing passively Web service compositions in Clouds

Model-Based Testing. Theory Tools Applications SUT. model. Jan Tretmans

Quasimodo. under uncertainty. Alexandre David & K.G Larsen & Aalborg University, DK.

Sequence-Based Specification

Test suite development for conformance testing of protocols

Test design techniques

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

Online Testing with Reinforcement Learning

Programming Embedded Systems

Killing strategies for model-based mutation testing

A Model-based Certification Framework for the EnergyBus Standard

Automatically Tracking Model Based Testing of Asynchronously Communicated Protocol Implementations

So, You Want to Test Your Compiler?

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

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

On-The-Fly Testing of Reactive Systems

Chapter 10. Testing and Quality Assurance

CSE 431S Scanning. Washington University Spring 2013

Real-time Testing with Timed Automata Testers and Coverage Criteria

Simulation-Based FlexRay TM Conformance Testing an OVM success story

Abstract This thesis presents a mathematical model for test selection problem in protocol conformance testing, the goal of which is to select a test s

V&V: Model-based testing

Chap 2. Introduction to Software Testing

[IT6004-SOFTWARE TESTING] UNIT 2

XIV. The Requirements Specification Document (RSD)

INTRODUCTION TO SOFTWARE ENGINEERING

ON-THE-FLY FORMAL TESTING OF A SMART CARD APPLET

Fault-based Conformance Testing in Practice

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

Open XML Requirements Specifications, a Xylia based application

UNIVERSIDAD POLITÉCNICA DE MADRID

M. De Wulf, L. Doyen,J.-F. Raskin Université Libre de Bruxelles Centre Fédéré en Vérification

Model-Based Testing of Thin-Client Web Applications

Software Specification Refinement and Verification Method with I-Mathic Studio

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Winter /15/ Hal Perkins & UW CSE C-1

Heuristics for Faster Error Detection with Automated Black Box Testing

Test Automation Beyond Regression Testing

MONIKA HEINER.

Testing, Debugging, Program Verification

Towards Fault-based Generation of Test Cases for Dependable Embedded Software

Reading assignment: Reviews and Inspections

The Verilog Hardware Description Language Testing the Design Overview

FlexRay TM Conformance Testing using OVM

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models

Automated Refinement Checking of Asynchronous Processes. Rajeev Alur. University of Pennsylvania

Part I: Preliminaries 24

Transforming Source Code into Symbolic Transition Systems for Practical Model-Based Testing

COMPOSITIONAL TESTING FOR FSM-BASED

RobusTest: Towards a Framework for Automated Testing of Robustness in Software

Online Testing with Model Programs

Simulation-Based FlexRay TM Conformance Testing using OVM. Mark Litterick Senior Consultant and Co-Founder, Verilab

Testing: Test design and testing process

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

Timo Latvala. January 28, 2004

2 STG: The Symbolic Test Generation Tool

Part 5. Verification and Validation

Simulation-Based FlexRay TM Conformance Testing - An OVM Success Story

Observability and Controllability Issues in Conformance Testing of Web Service Compositions

Professor Hausi A. Müller PhD PEng FCAE Department of Computer Science Faculty of Engineering University of Victoria

WIRELESS LANs: THE DECT APPROACH

WHY TEST SOFTWARE?...

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

CITS5501 Software Testing and Quality Assurance Formal methods

Implementing heuristic testing selection

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

Orccad Control Architecture

Introduction to Software Engineering

Formal Modeling of Testing Software for Cyber-Physical Automation Systems

Automatic Test Generation from Interprocedural Specifications

Using Model Checking to Generate Tests from Requirement Specifications

Software processes, quality, and standards Black box testing

Is Javacardsign correct and secure? Bachelor Thesis

TorX : Automated Model Based Testing

TESTBEDS Paris

Specification and Analysis of Contracts Tutorial

Observability and Controllability Issues in Conformance Testing of Web Service Compositions

Sequencing and control

Towards checking Stateflow models with mcrl2

Turing Machines, continued

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

ETSI EN V1.1.1 ( )

A Global Algorithm for Model-Based Test Suite Generation

Testing: Coverage and Structural Coverage

Regular Expression Constrained Sequence Alignment

Second assignment came out Monday evening. Find defects in Hnefetafl rules written by your classmates. Topic: Code Inspection and Testing

Business Process Modelling

Review of Regression Test Case Selection Techniques

Verification of Power Management Protocols through Abstract Functional Modeling

Slides 11: Verification and Validation Models

May 2001 WHITE PAPER STATE. Software Tool for. Automated Test Environment.

Transcription:

November 30th, 2010

Testing is Inevitable Can be applied to the actual implementation Scales up Can be applied to the actual implementation No need to build a model of the system It is complex to build a model The system is a combination of software and hardware

The Testing Problem Test suite generation Test execution and behaviour observation Test oracle

The Challenges of Testing It involves a lot of effort to: simulate the deployment environment come up with a good test suite run the tests verify the tests Thus the need to automate these activities Relatively easy to automate test execution and verification Challenging to automate test case development

Testing and System Specification Testing verifies the system against a specification An incomplete/inaccurate/ambiguous specification hinders testing Test-driven development addresses this issue by forcing programmers to write their tests before coding (Forcing them to write a low-level specification) Formal specifications are unambiguous and can be processed automatically

Different Types of Testing Aspect to be tested Functionality Reliability Availability Robustness Load Level of abstraction Unit Integration System Levels of system visibility White box Grey box Black box

Model-Based Testing Black box, functional testing... conformance (w.r.t specs) testing Use a model of the system to intelligently test it: Guide test-case generation As an oracle of the test results

Testing Reactive Systems Reactive systems continually react to stimuli from the environment Examples: embedded systems and protocols Generating tests on-the-fly (while executing) is beneficial as the test can be arbitrarily long

Labelled Transition Systems a s s when the system is in state s, it may perform interaction a and progresses to state s?but?but!choc r 1 ========= the labelled transition system can produce chocolate after two button presses [TB99]

Input/Output A set of input actions L I : {?a,?b,...} A set of output actions L U : {!a,!b,...} With all inputs enabled at each state: s S,?a L I s?a S s s

Definition of Conformance Let i represent an input/output transition system and s a specification in terms of a labelled transition system s after σ = def {s s out(s) = def {a L U s σ = s } a } {δ a L U : p a } out(s after σ) all outputs possible when consuming σ starting from s L = L I L U {δ} i ioco s σ L out(i after σ) out(s after σ)

Definition of Conformance Let i represent an input/output transition system and s a specification in terms of a labelled transition system s after σ = def {s s out(s) = def {a L U s σ = s } a } {δ a L U : p a } out(s after σ) all outputs possible when consuming σ starting from s L = L I L U {δ} i ioco s σ L out(i after σ) out(s after σ) i implements s if in any situation it never produces an output not produced by the specification s.

Example r 2 ioco r 1 but not r 1 ioco r 2

Example r 2 ioco r 1 but not r 1 ioco r 2!choc out(r 1 after?but δ?but) and!choc / out(r 2 after?but δ?but)

The Perfect Test Suite Detects all ioco-erroneous implementations...

The Perfect Test Suite Detects all ioco-erroneous implementations (completeness)

The Perfect Test Suite Detects all ioco-erroneous implementations (completeness) Detects only ioco-erroneous implementations...

The Perfect Test Suite Detects all ioco-erroneous implementations (completeness) Detects only ioco-erroneous implementations (soundness)

The Perfect Test Suite Detects all ioco-erroneous implementations (completeness) Detects only ioco-erroneous implementations (soundness) Given a spec. s, an implementation i Test suite T s generated by algorithm T on spec s

The Perfect Test Suite Detects all ioco-erroneous implementations (completeness) Detects only ioco-erroneous implementations (soundness) Given a spec. s, an implementation i Test suite T s generated by algorithm T on spec s The perfect algorithm would have that: i,s : i ioco s test exec(t s,i) = pass

A Practical Test Suite In practice it is not feasible to have a sound and complete test suite Therefore we at least need soundness... if a test fails, then we are sure the implementation is incorrect

Test Cases A test case is a labelled transition system (lts) with a special structure: A finite and tree-structured lts each terminal state is either pass or fail for each non-terminal state, there is either: a transition labelled with a system input or a transition for each system output and another with θ (a timeout)

Test Case Example

Test Case Execution Executing a test case involves: Executing the test case and the implementation simultaneously If the test case lts ends in a failure, then the fail verdict is assigned...... and vice-versa if the test case succeeds

Test Case Execution Example Executing both lts simultaneously may result in?but θ?but!liq Leading to fail

Test Derivation Algorithm s is a lts specification with initial state s 0 S is a set of states in which the implementation can be in at a particular stage of the test case A test case t is obtained from s by applying one of the following non-deterministic choices 1 t := pass 2

Test Derivation Algorithm Try all possible outputs and check which would signify a failure.

On-the-fly Testing Test inputs and outputs are generated lazily... step by step (as in the algorithm described above) either the tester decides to generate a stimulus to the implementation under test (IUT) or the tester observes the output produced by the IUT

Advantages of Testing with Formal Methods Reduce ambiguity in specifications Automatic maintenance of tests Arbitrarily long tests generated lazily

Disadvantages of Testing with Formal Methods Random testing instead of manually selected test cases Steep learning curve High initial costs to come up with formal specifications

References G. J. Tretmans and A. F. E. Belinfante. Automatic testing with formal methods. In EuroSTAR 99: 7th European Int. Conference on Software Testing, Analysis & Review, Barcelona, Spain, Galway, Ireland, 1999. EuroStar Conferences.