Automated Derivation of Random Generators for Algebraic Data Types
Licentiate thesis, 2020

Many testing techniques such as generational fuzzing or random property-based testing require the existence of some sort of random generation process for the values used as test inputs. Implementing such generators is usually a task left to end-users, who do their best to come up with somewhat sensible implementations after several iterations of trial and error. This necessary effort is of no surprise, implementing good random data generators is a hard task. It requires deep knowledge about both the domain of the data being generated, as well as the behavior of the stochastic process generating such data. In addition, when the data we want to generate has a large number of possible variations, this process is not only intricate, but also very cumbersome.

To mitigate this issues, this thesis explores different ideas for automatically deriving random generators based on existing static information. In this light, we design and implement different derivation algorithms in Haskell for obtaining random generators of values encoded using Algebraic Data Types (ADTs). Although there exists other tools designed directly or indirectly for this very purpose, they are not without disadvantages. In particular, we aim to tackle the lack of flexibility and static guarantees in the distribution induced by derived generators. We show how automatically derived generators for ADTs can be framed using a simple yet powerful stochastic model. This models can be used to obtain analytical guarantees about the distribution of values produced by the derived generators. This, in consequence, can be used to optimize the stochastic generation parameters of the derived generators towards target distributions set by the user, providing more flexible derivation mechanisms.

Random Testing, Penetration Testing, Meta-programming, Haskell

Opponent: Leonidas Lampropoulos, University of Maryland/University Of Pennsylvania, United States


Claudio Agustin Mista

Chalmers, Computer Science and Engineering (Chalmers), Information Security

Generating Random Structurally Rich Algebraic Data Type Values

2019 IEEE/ACM 14th International Workshop on Automation of Software Test (AST),; (2019)p. 48-54

Paper in proceeding

Deriving Compositional Random Generators

ACM International Conference Proceeding Series,; Vol. 25 September 2019(2019)

Paper in proceeding

Branching Processes for QuickCheck Generators

Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell,; Vol. 53(2018)p. 1-13

Paper in proceeding

Octopi: Säker Programering för Sakernas Internet

Swedish Foundation for Strategic Research (SSF) (RIT17-0023), 2018-03-01 -- 2023-02-28.

WebSec: Securing Web-driven Systems

Swedish Foundation for Strategic Research (SSF) (RIT17-0011), 2018-03-01 -- 2023-02-28.

Areas of Advance

Information and Communication Technology

Subject Categories

Probability Theory and Statistics

Computer Science

Computer Systems




Opponent: Leonidas Lampropoulos, University of Maryland/University Of Pennsylvania, United States

More information

Latest update