Questions tagged [property-based-testing]

144 questions
0
votes
1 answer

In scala property based tests for tagless final with variable inerpreter

I have the following algebra // domain case class User(id: String, name: String, age: Int) // algebra trait UserRepositoryAlgebra[F[_]] { def createUser(user: User): F[Unit] def getUser(userId: String): F[Option[User]] } I have a…
nashter
  • 1,181
  • 1
  • 15
  • 33
0
votes
1 answer

In the Hypothesis library for Python, why does the text() strategy cause custom strategies to retry?

I have a custom strategy built using composite that draws from text strategy internally. Debugging another error (FailedHealthCheck.data_too_large) I realized that drawing from the text strategy can cause my composite strategy to be invoked roughly…
levand
  • 8,440
  • 3
  • 41
  • 54
0
votes
0 answers

Trouble importing hypothesis in python

After following the quick start from https://hypothesis.readthedocs.io/en/latest/quickstart.html I import the hypothesis, when i run the code I get this -> ModuleNotFoundError: No module named 'hypothesis' pip install hypothesis import…
gma2022
  • 1
  • 1
0
votes
0 answers

Why is my test.check test using inputs smaller than the generator?

I've implemented my own version of index-of. It takes two strings and returns the index where the second string is found in the first. In use, it seems to work fine, but it's failing the test.check property test. The weird thing is test.check says…
triplej
  • 269
  • 4
  • 9
0
votes
1 answer

Hypothesis, using "one_of" with Pandas dtypes in the "data_frames" strategy

I would like to construct a Pandas series that is any of several dtypes. I was hoping to do something like this: from hypothesis import given import hypothesis.strategies as hs import hypothesis.extra.numpy as hs_np import hypothesis.extra.pandas as…
shadowtalker
  • 12,529
  • 3
  • 53
  • 96
0
votes
1 answer

How to create JSON object strategy according to a schema with rust proptest?

I'd like to create a JSON strategy using rust proptest library. However, I do not want to create an arbitrary JSON. I'd like to create it according to a schema (more specifically, OpenAPI schema). This means that keys of the JSON are known and I do…
matusf
  • 469
  • 1
  • 8
  • 20
0
votes
1 answer

QuickCheck Stack Overflow

I have the following struct: pub struct Restriction { pub min: Option, pub max: Option, } for which I have defined Arbitrary as follows: impl Arbitrary for Restriction { fn arbitrary(g: &mut Gen) -> Self { let x =…
James Burton
  • 746
  • 3
  • 12
0
votes
2 answers

When to choose Example based testing and property based for Stateful Testing

I'm doing unit testing mostly these days for Android SDK in Android Studio and using Jqwik which is a Property-Based testing tool on the JUnit Platform. While exploring the different test techniques approach with my seniors, I learned about…
Sagar Khurana
  • 184
  • 1
  • 2
  • 11
0
votes
0 answers

Scala - handle Eithers in property based testing

I am creating property based tests for my scala project but I don't know how I should handle Eithers in my generators. Here's an example. def genCompany: Gen[Company] = for { letter <- Gen.oneOf('A' to 'Z') company =…
to.mane
  • 13
  • 3
0
votes
2 answers

Jqwik: How to check if all possibilities is covered?

How to check if all possibilities (cartesian product of arguments) is covered in summary by N properties? Some of them can be tested few times by different properties.
0
votes
1 answer

Is there any method of generating arbitrary equivalent regular expressions?

I want to write tests for a regular expression analysis engine. It would be nice if I could generate arbitrary pairs of equivalent regular expressions, to see whether the engine correctly parses them and identifies them as being equivalent. Is there…
ahelwer
  • 1,441
  • 13
  • 29
0
votes
1 answer

How to make the property test get a collection of entities an entity-generator can return?

I have recently started exploring property based testing using junit-quickcheck. I came across an usecase where a property has to take a list of entities(I have a generator for a standalone entity). I have tried with the code below and it always…
Kranthi
  • 37
  • 6
0
votes
1 answer

How does python-hypothesis shrink a deferred strategy

I am at the moment implementing PBB for Matlab and am somehow influenced by hypothesis. I do not understand how hypothesis handles the shrinking of deferred strategies. In the documentation there is the code snippet import hypothesis.strategies as…
tommsch
  • 582
  • 4
  • 19
0
votes
0 answers

rapidcheck generator for a struct with a c style array as member

Suppose I have the following struct: struct Data { float zs[50]; }; I'm trying to create a rapidcheck generator similarly to the ones defined here such as: // NOTE: Must be in rc namespace! namespace rc { template<> struct Arbitrary { …
hao123
  • 381
  • 2
  • 6
  • 21
0
votes
1 answer

Proptest: Strategy to generate vectors of vectors

I want to generate DAGs with proptest. The algorithm that I pick would be this. I've written the plain algorithm below -- but I need help transforming this to a proptest strategy. What would a strategy need to look like that did the same as the…
Unapiedra
  • 15,037
  • 12
  • 64
  • 93