Testing in Erlang. Different testing tools EUnit (standard lightweight xUnit solution for Erlang) Common Test (OTP based distributed testing tool) Qucik.

Slides:



Advertisements
Similar presentations
Software Testing with QuickCheck Lecture 1 Properties and Generators.
Advertisements

Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Xiushan Feng* ASIC Verification Nvidia Corporation Automatic Verification of Dependency 1 TM Jayanta Bhadra
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Rossella Lau Lecture 8, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 8: Polymorphism & C++ pointer  Inheritance.
CS 280 Data Structures Professor John Peterson. Next Project YET ANOTHER SORT! We’ll do Quicksort using links instead of arrays. Wiki time.
WRT 2007 Refactoring Functional Programs Huiqing Li Simon Thompson Computing Lab Chris Brown Claus Reinke University of Kent.
1 Advanced Material The following slides contain advanced material and are optional.
© S. Demeyer, S. Ducasse, O. Nierstrasz Chapter.1 Unit Testing Explained How to support changes? How to support basic but synchronized documentation?
Combining Temporal Logic Path Planning with Sampling based Path Planning Hadas Kress-Gazit.
CPSC Compiler Tutorial 3 Parser. Parsing The syntax of most programming languages can be specified by a Context-free Grammar (CGF) Parsing: Given.
Stevenson and Ozgur First Edition Introduction to Management Science with Spreadsheets McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Testing a Media Proxy with … QuickCheck Thomas Arts John Hughes Chalmers/ITU Joakim Johansson Ulf Wiger Ericsson.
1 Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Erlware For Managing Distribution and Build Erlang User Conference 2007.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Erlang/QuickCheck Thomas Arts, IT University John Hughes, Chalmers University Gothenburg.
(or what I learned from Neil about software testing) John Hughes Chalmers University/Quviq AB.
Generation Why: How Generation Data Sets Can Help Lisa Eckler, Lisa Eckler Consulting.
Property-Based Testing with QuickCheck John Hughes.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Polynomial Expressions Section P.3. Definition of Polynomial An algebraic expression of the form Where all coefficients a i are real numbers, The degree.
Formal Methods in SE Lecture 20. Agenda 2  Relations in Z Specification Formal Methods in SE.
Learn to evaluate expressions with negative exponents.
Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.
B. Fernández, D. Darvas, E. Blanco Formal methods appliedto PLC code verification Automation seminar CERN – IFAC (CEA) 02/06/2014.
Oracle Data Integrator Procedures, Advanced Workflows.
1 Hybrid-Formal Coverage Convergence Dan Benua Synopsys Verification Group January 18, 2010.
Simulation is the process of studying the behavior of a real system by using a model that replicates the behavior of the system under different scenarios.
QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs By Koen Claessen, Juhn Hughes ME: Mike Izbicki.
Geoffrey Duval (ISAE-SUPAERO) Naples, October 1 st, 2012.
Simple Java Unit Testing with JUnit 4 and Netbeans 6.1 Kiki Ahmadi JUG-Bonek.
Testing Abstract Data Structures with QuickCheck Thomas Arts Quviq AB / Chalmers.
Testing, Testing & Testing - By M.D.ACHARYA QA doesn't make software but makes it better.
Function Definition by Cases and Recursion Lecture 2, Programmeringsteknik del A.
Scalable Clone Detection and Elimination for Erlang Programs Huiqing Li, Simon Thompson University of Kent Canterbury, UK.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
EUnit a powerful unit testing framework for Erlang Richard Carlsson Mickaël Rémond.
Properties of Exponents – Part 1 Learn multiplication properties of exponents.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
Effective C# Item 10 and 11. Understand the Pitfalls of GetHashCode Item 10.
Mutation Testing Breaking the application to test it.
ISA 95 Working Group (Business) Process Centric Exchanges Dennis Brandl A Modest Proposal July 22, 2015.
Google C++ Testing Framework Part 2: Assertion. Concepts A test case contains one or many tests. ◦ You should group your tests into test cases that reflect.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
Copyright 2015 Varigence, Inc. Unit and Integration Testing in SSIS A New Approach Scott @varigence.
Integers: One of the positive or negative numbers I,2,3 Ex: 2+(-6)=-4.
September 24th 2006, aKademy The Design and Implementation of KJSEmbed Richard Moore,
CSE 220 – C Programming Expressions.
Distributive Property
Algebra.
Physical Structure of GDB
Test Data Generators.
CS212: Object Oriented Analysis and Design
Cracking the Coding Interview
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
Lecture 5: Lexical Analysis III: The final bits
} 2x + 2(x + 2) = 36 2x + 2x + 4 = 36 4x + 4 = x =
Evaluating expressions and Properties of operations
Substitution method y= 3x+1 5x + 2 y =13 Solve:
Unit 7 - Short-Circuit Evaluation - De Morgan’s Laws - The switch statement - Type-casting in Java - Using Math.random()
Solving Multi Step Equations
Simplify by combining like terms
Solving Multi Step Equations
Exercise Find the following products mentally. 5(20) 100 5(7) 35 5(27)
Software Testing Software Testing is a process of evaluating a system by manual or automatic means and verify that it satisfies specified requirements.
Presentation transcript:

Testing in Erlang

Different testing tools EUnit (standard lightweight xUnit solution for Erlang) Common Test (OTP based distributed testing tool) Qucik Check (property based testing tool)

A simple problem (deleting from a list) 4>lists:delete(2,[1,2,3]). [1,3] 5>lists:delete(4,[1,2,3]). [1,2,3] We should write a test for delete like this: delete_present_test()-> lists:delete(2,[1,2,3])==[1,3]. delete_absent_test()-> lists:delete(4,[1,2,3])==[1,2,3].

Problems with xUnit style solution Lots of work to create “good” tests and various test cases The code as good as your tests Can’t create and validate with formal specification

What other solution is possible We’d like to generalise our tests We’d like to generate or run different cases automatically We’d like to avoid the “human failure” from the system (if it is even possible) We’d like to write something like this: prop_delete(I,L)-> notlists:member(I,lists:delete(I,L)).

QuickCheck is the solution With QuickCheck we can test our property automatically in many cases without the effort of specifying each case manually So we can write QuickCheck property like this: prop_delete()-> ?FORALL({I,L},{int(),list(int())}, notlists:member(I,lists:delete(I,L))).

Test data generators Instead of the logically meaning QuickCheck interprets the expression as a data generator int() is a generator of random integers list(int()) is a generator of random lists containing integers {int(), list(int)} produces pairs of integer and a list of integers ?FORALL binds {I,L} to the pattern {int(), list(int)}

Running the test eqc:quickcheck(examples:prop_delete()). Works fine! eqc:quickcheck(eqc:numtests(1000,examples: prop_delete())). Fails… Diagnosis and shrinking

Conditional properties ?IMPLIES prop_delete()-> ?FORALL({I,L},{int(),list(int())}, ?IMPLIES(no_duplicates(L), not lists:member(I,lists:delete(I,L)))). no_duplicates(L)- >lists:usort(L)==lists:sort(L).

Custom generators We can create our own generators ulist(Elem)-> ?LET(L,list(Elem), lists:usort(L)).