The TestExplode package

[Tags:lgpl, library]

Generates testcases from program-snippets in any language, with varables, that are substituted and a directed graph structure of the snippets and test hints

[Skip to Readme]


Dependencies base (<5), containers (==0.5.*), directory (==1.2.*), fgl (==5.5.*), graphviz (>=2999.17 && <2999.19), interpolatedstring-perl6, mtl (==2.2.*), process (>=1.2), text (==1.2.*) [details]
License LGPL-3
Copyright (c) Hans-Jürgen Guth 2015
Author Hans-Jürgen Guth
Stability Unknown
Category Testing
Home page
Source repository this: git clone git://
Uploaded Wed Jun 10 22:11:08 UTC 2015 by hjg
Updated Sat Feb 13 22:53:12 UTC 2016 by hjg to revision 3
Distributions NixOS:
Downloads 179 total (4 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2015-06-11 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for TestExplode

Readme for TestExplode-


TestExplode -- let the set of your test cases explode !

Motivation and what the heck this module does

"DRY, Don't repeat yourself" is not valid, if you write testcases. Every time you use the same sort of code, with different values for variables or another function at one place. Copy & paste is your friend.

That need not to be! This module shall enable you to write the structure of whole test sets.

You have two building blocks:

  1. variables that can change. Every testcase uses another combination of variables. For defining the set of variables you can use the list-comprehension of haskell.

  2. Define the structure of your testcases as directed graphs with one begin and one end. Every path of the graph forms one testcase. And this testcase is generated with all the variable-combinations, that you have defined with the method of 1.)


  1. Why not combine existing testcases with new testcases ? You can import another testgraphs. You must only cast the types of variables that the imported testgraph uses.

  2. Defining what the testcase shall do is one thing, defining what the expected outcome of the testcase is is the other. To every snippet of the testcase you can add the state of the system under test, using the input testdata and the state of the system under test before that snippet. The state you can use in defining the result of the test.

The module combines texts, that you write. This texts are snippets of the testcase. So in the text you can use whatever language you want, the resulting testcase is in this language.

To make the testcase well commented, you must say, what the comment-chars of your text/programming language are. If you write python or perl this are "# ", in haskell "-- ".

The official modules of this package generate you a sequence of Texts. Every text is a testcase. To make files out of the text, with a header and a footer and a nice name, the module FinalIO.hs in the doc/examples-directory can be used. Because the module is not so modular, and every user wants a bit other header and footers, it is not an official module. But it works for me. Feel free to change it.

For the same reasons the module VizViews.hs is not an official module and included in the directory docs/examples. This module defines attributes for graphviz. By that we come to the next feature of TextExplode: Visualization of the testgraph.

The testgraph is a graph and can be printed with graphviz. Subgraphs can be hidden in a node and with a click on the node you come to the subgraph. This modules use graphviz and interpret the testgraphs, so that they can be printed with graphviz.


mkdir TestExplode
cd TestExplode
cabal sandbox init
cabal install TestExplode

should do the job.

Additionally install graphviz with your package manager or on windows with the instructions at


There are examples in the directory doc/examples. I recommend Te_LA.hs as a starting point. After you have understood the design of a testcase, you can go further and understand, how testcses are iported with the example Te52.hs.

Of course the most complete docu is the haddock documentation of this module.

The command for generating the testcases out of Te_LA.hs is:

runghc Te_LA.hs

The resulting testcases can be found in Te_LA/*.rb. The resulting Testgraph can be found under Te_LA/Te_LA.svg.

The subgraphs can be found under subgraphs/.

Much fun and I like getting mails about the usage of the module. Write me, if you like!