Property Based Tesing
-
Upload
marten-range -
Category
Software
-
view
57 -
download
1
Transcript of Property Based Tesing
Property Based Testing done properly...
▸Improves productivity
▸Improves test quality
▸Finds more bugs during development
§4 – Parent key is greater than left child,smaller than right child
§5 – No Red Node has a Red child
§6 – Every path from the Root to a Leaf containsthe same number of nodes
§7 – §5 + §6 Tree depth at most 2[log2 (n + 1)]
type Color =| Red| Black
type Tree<'K, 'V> =| Leaf // Left child Right child| Node of Color*Tree<'K, 'V>*'K*'V*Tree<'K, 'V>
static member ``test chunkBySize`` (sz : int) (vs : int []) =let sz = wrap sz - 1 vs.Lengthlet e = vs |> chunkBySize szlet a = vs |> Stream.ofArray
|> Stream.chunkBySize sz |> Stream.toArray
e = a
static member ``test collect`` (vs : int [] []) =let e = vs |> Array.collect idlet a = vs |> Stream.ofArray
|> Stream.collect Stream.ofArray |> Stream.toArray
e = a
type Json =| JsonNull| JsonBoolean of bool| JsonNumber of float| JsonString of string| JsonArray of Json []| JsonObject of (string*Json) []
type Ws = Whitespace []* Whitespace []
type WsJson =| WsJsonNull Ws| WsJsonBoolean of Ws*bool| WsJsonNumber of Ws*float| WsJsonString of Ws*string| WsJsonArray of Ws*WsJson []| WsJsonObject of Ws*((Ws*string)*Json) []
Property Based Testing Frameworks
▸QuickCheck (Haskell)
▸FsCheck (.NET)
▸ScalaCheck (Scala)
▸JUnit-QuickCheck (Java)