Questions tagged [generative-testing]
12 questions
13
votes
2 answers
FsCheck in C#: generate a list of two dimension arrays with the same shape
Let's say I'm writing some code for video analysis. Here is a simplified version of a Video class:
public class Video
{
public readonly int Width;
public readonly int Height;
public readonly List Frames;
public Video(int…

Pavel Murygin
- 2,242
- 2
- 18
- 26
11
votes
3 answers
Howto include clojure.spec'd functions in a test suite
Is there anyway to include clojure.spec'd functions in a generalized test suite? I know we can register specs and directly spec functions.
(ns foo
(:require [clojure.spec :as s]
[clojure.spec.test :as stest]))
(defn average [list-sum…

Nutritioustim
- 2,686
- 4
- 32
- 57
6
votes
2 answers
What is generative testing in Clojure?
I came across Generative Testing in Clojure with spec notion and would like to learn about it.
Also providing some examples would be very useful.

Ertuğrul Çetin
- 5,131
- 5
- 37
- 76
5
votes
2 answers
How do I compose clojure.test.check generators in a one to many fashion?
Let us say I have a generator users-gen, that generates a group of 1 or more users. And another parameterized generator called user-actions-gen that takes a sequence of one or more users and generates a sequence of actions that those users might…

Stephen Cagle
- 14,124
- 16
- 55
- 86
3
votes
1 answer
Using a generative test library in clojure vs build your own using higher order functions
Clojure has a number of libraries for generative testing such as test.check, test.generative or data.generators.
It is possible to use higher order functions to create random data generators that are composable such as:
(defn gen [create-fn…

optevo
- 2,016
- 20
- 17
2
votes
1 answer
Need help understanding why Clojure spec test/check is failing the return validation when REPL doesn't fail
I've been playing around with Clojure Spec for testing and data generation and am seeing some strange behavior where the function works in unit tests and validation works in REPL but the generative testing with spec.test/check is failing.
I've…

Chris Lester
- 23
- 3
2
votes
1 answer
Why is my Scalacheck test with a custom Generator failing after discarding many cases, and how do I fix this?
I am a newbie with Scala and I am writing my first Scalacheck suite.
I have a data structure in my program that essentially looks like a (List[Double], List[Double]) which is well-formed only if each element of _1 is strictly greater than the…

Tobia Tesan
- 1,938
- 17
- 29
1
vote
1 answer
How to generative test function-under-test with must-to-test distinct edge cases for each execution?
Hello Clojure experts..!,
Update: 08/03/2018 1:25PM CDT - Rephrased the question to make it more descriptive.
Update: 08/03/2018 4:10PM CDT - Added negative scenario test to make more sense.
I have a function/spec-under-test (jvm-languages), i want…

Dhanapathi Javvadi
- 13
- 5
1
vote
1 answer
How to check Clojure, macro specs?
If I try to check a macro spec with clojure.spec.test.alpha, no tests are run, but if I define the same macro as a function with the same spec, a sequence of tests are run against the function. I can always generate parameters to unit test the…

Dylon
- 1,730
- 15
- 14
0
votes
1 answer
Is clojure.spec check generating bad input?
Using clojure.spec (org.clojure/clojurescript {:mvn/version "1.10.520"}), I have a function spec that specifies a map for its input.
gen/generate and gen/sample work fine. But calling cljs.spec.test.alpha/check errors with input that should be a…

Nutritioustim
- 2,686
- 4
- 32
- 57
0
votes
1 answer
test.check generate tree with different node types
I want to generate a tree with different node types. For each node type there are different possible combinations of node types that can become children of that node. Any node type may have no children.
recursive-gen essentially forces me to build…

Leon Grapenthin
- 9,246
- 24
- 37
0
votes
2 answers
How to assert in Generative Testing?
I am a novice in testing. I have developed a module which takes around 14 variables and output True/False. For testing I have used randomly generated test cases using 'Quickcheck'.
However the 14 variables are generated randomly (since number of…

Mangat Rai Modi
- 5,397
- 8
- 45
- 75