Completely convinced of Spec, I am diving into property-based testing with 
test.check. However, I encounter some difficulties for which I would like 
to get the community's input. 

The central part of the software I am developing, consists of a tree of 
different kinds of nodes that can refer to — and interact with — each 
other. There are many business rules that specify how those nodes can 
interact — e.g., a node of type A can refer to other nodes of types B and C 
(but not D); or a node can have max. 3 child nodes of type E but more than 
3 child nodes of type F. 

It is trivial to have Spec generate completely random nodes to test 
functions that can ignore the business rules. However, other functions do 
depend on the business rules, and for those it is necessary to somewhat 
"guide" the generators towards random-but-compliant output. And here I'm 
stumbling: due to the business rules' complexity, this is not a matter of 
simply inserting a few such-that generators, so that I have already spent 
many days on writing a business rule compliant generator. Part of this is 
due to the multitude and complexity of the business rules, part due to the 
difficulty of writing generators (which operate at a higher level of 
abstraction, and for which only a subset of the normal Clojure constructs 
can be used).

How do others cope with this issue? I have the feeling that I am pushing 
the generators far beyond what they were designed to do, but at the same I 
have to acknowledge that the time required to write traditional tests for 
functions dealing with the business rules is also substantial — so maybe 
the time required to write those generators is not abnormal.   

Any suggestions are welcomed! I did not find any in-depth observations of 
other developers about property-based testing on the Net.

Maarten

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to