Questions tagged [property-based-testing]
144 questions
1
vote
1 answer
What is an example of a buggy function that would be hard to find to discover the bug without fuzz testing?
I'd like to come up with a motivating example or code challenge for fuzz testing and/or property-based testing.
What I'm looking for is a concise situation where such testing is maximally critical/necessary.
For example, ideally it would take enough…

llllvvuu
- 286
- 1
- 9
1
vote
1 answer
In scalacheck + scalatest, is it possible to set randomisation seed for `Gen` WITHOUT sbt?
Assuming that in a Maven / Gradle project, a property-based test fails sporadically:
import org.scalacheck.Gen.Parameters
import org.scalacheck.rng.Seed
import org.scalacheck.{Arbitrary, Gen}
import org.scalatest.Assertion
import…

tribbloid
- 4,026
- 14
- 64
- 103
1
vote
1 answer
Not in scope: type constructor or class `GenUnchecked'
I want to set up property based testing using validity, but I'm having trouble getting even this simple example from the documentation to compile:
module PrimeSpec where
import Data.GenValidity
import Data.Validity
import Data.Numbers.Primes
import…

Good Night Nerd Pride
- 8,245
- 4
- 49
- 65
1
vote
1 answer
How to add explicit edge cases to a generator / arbitrary in FsCheck w/ C#?
Background
I have two extension methods, DateOnly.BeginningOfDay & DateOnly.EndOfDay , that are supposed to help in turning a DateOnly object into a DateTime object. The tests for these methods are written in FsCheck. FsCheck has no built in…

Tyler Kasper
- 53
- 4
1
vote
2 answers
Better Arbitrary Number?
I need an Arbitrary java.lang.Number.
Here is what I came up with:
@Provide
Arbitrary numbers(){
return
Combinators.combine(
Arbitraries.integers().between(0, 5),
…

Gabriel
- 1,679
- 3
- 16
- 37
1
vote
1 answer
Are there Rust QuickCheck ports which support running with a seed
I'd like to do quickcheck/property-based testing and have it run in CI, but I don't want to add a randomized test to CI (since it could potentially fail when someone else is attempting to merge an unrelated change and force them to re-run).
Are…

David Spies
- 93
- 5
1
vote
1 answer
jqwik double generator cannot be represented with scale
when using "chained" double generators with jqwik I get a scale error message java.util.concurrent.ExecutionException: net.jqwik.api.JqwikException: Decimal value -1.6099999999999999 cannot be represented with scale 4..
Can you provide me with some…

Antonin
- 879
- 2
- 10
- 27
1
vote
1 answer
How to set a project wide configuration for iterations in property tests in kotest?
I'd like to limit the default number of iterations for Property Based Tests in Kotest, preferably in the code (instead of using the also existing system property kotest.proptest.default.iteration.count inside my gradle/maven project).
The Global…

Chris
- 408
- 2
- 10
1
vote
1 answer
Kotlin and kotest with arbitrary values: what am I doing wrong?
I've gone through the kotest documentation and am trying to incorporate some property based testing into my code. From the documentation, my impression was that if you use a forAll, if kotest has a built-in Arb, it would generate arbitrary…

Sebastian
- 715
- 6
- 13
1
vote
0 answers
What's the proper way to have mocha's `describe` inside of fast-check's `property`
An alternative problem would be "How to check if mocha's describe has finished running all tests successfully".
I test an entity parameterized by several parameters (let's call it a and b). I have a test-suite for this entity encoded within mocha's…

grepcake
- 3,960
- 3
- 16
- 26
1
vote
1 answer
kotest: automatically derive Generator from data class
I wonder if it's possible to automatically derive a Generator from a data class like e.g. scalacheck-shapeless?

Stefan K.
- 7,701
- 6
- 52
- 64
1
vote
1 answer
Looking for better ways to generate a list of edges for a graph in jqwik property testing framework
Currently I am using:
@Provide
Arbitrary
- >> edgeLists (
TypeUsage type, ArbitraryProvider.SubtypeProvider subtype) {
int vertices = 10;
int degree_min = 1;
int…

FeralWhippet
- 13
- 4
1
vote
1 answer
Arbitrary created with flatMap does not consider the filter
I am trying jqwik (version 1.5.1) and I read from the documentation that I can create an Arbitrary whose generated value depends on the one supplied by another Arbitrary, specifically using the flatMap function.
My actual goal is different, but…

Marco Luzzara
- 5,540
- 3
- 16
- 42
1
vote
0 answers
Run a property-test's iterations in parallel?
I have a property-based test (in Hedgehog), that does the following:
Push an item to a remote service that queues it
Poll the remote service to figure out when the item was processed
Assert some properties on the item's processing results
The test…

Saurabh Nanda
- 6,373
- 5
- 31
- 60
1
vote
1 answer
Generating recursive structures in scalacheck
I'm trying to make a generator for a recursive datatype called Row. A row is a list of named Vals, where a Val is either an atomic Bin or else a nested Row.
This is my code:
package com.dtci.data.anonymize.parquet
import…

mac01021
- 745
- 4
- 13