Use `property-based-testing` instead.
Questions tagged [property-testing]
17 questions
5
votes
1 answer
How to use QuickCheck in Hspec tests?
I build the initial codebase for my Haskell project with cabal init
I have several tests written with Hspec.
On cabal test it compiles and runs these tests like expected and gives a message for failing/passing.
Now I included a quickCheck test and…

christian wuensche
- 963
- 6
- 21
3
votes
2 answers
FsCheck: Override generator for a type, but only in the context of a single parent generator
I seem to often run into cases where I want to generate some complex structure, but a special variation with a member type generated differently.
For example, consider this tree
type Tree<'LeafData,'INodeData> =
| LeafNode of 'LeafData
|…

farlee2121
- 2,959
- 4
- 29
- 41
3
votes
1 answer
How to share test interfaces between Go packages?
Go doesn't share code between test files of different packages, so definitions of test interfaces aren't automatically reused. How can we work around this in practice?
Example using testing/quick:
foo/foo.go:
package foo
type Thing int
const (
X…

Mike Craig
- 1,677
- 1
- 13
- 22
3
votes
0 answers
How I can force evaluation of property tester manually in eclipse 4?
A application was updated from eclipse 3 to eclipse 4. The evaluation of some property tests are forced manually calling the following lines:
IEvaluationService service = (IEvaluationService)…

Holger S
- 53
- 5
2
votes
1 answer
Python Hypothesis - building strategy once for many tests?
I have a composite, expensive-to-build but cheap-to-test strategy. I must do:
@given(expensive_strategy())
def test_all(x):
assert...
assert...
...
It takes ~4 seconds to build the examples and negligible time to run the asserts.
Best…

Eric Kaschalk
- 369
- 1
- 4
- 8
2
votes
1 answer
Should property tests run with unit tests when using the RGR methodology?
Should property tests run with unit tests when using the RGR methodology?
RGR: Red -> Green -> Refactor
I noticed that a unit test that I have executes in 18ms.
However, my property test for the same method takes 215ms.
module Tests.Units
open…

Scott Nimrod
- 11,206
- 11
- 54
- 118
1
vote
1 answer
How do you write a new modifier in QuickCheck
I have come across a few instances in my testing with QuickCheck when it would have simplified things to write my own modifiers in some cases, but I'm not exactly sure how one would do this. In particular, it would be helpful to know how to write a…

josiah
- 1,314
- 1
- 13
- 33
1
vote
1 answer
How to report all test case input for scalacheck.Prop.forAll property test?
While using scalacheck if we test any property with forAll then we only get reported failed test inputs and none passed test inputs.
scala> import org.scalacheck.Prop.forAll
scala> val propConcatLists = forAll { (l1: List[Int], l2: List[Int]) =>
…

Saurabh kukade
- 1,608
- 12
- 23
1
vote
1 answer
scalacheck: define a generator for an infinite stream with some dependence on previous elements
I'm trying to define a Gen[Stream[A]] for an infinite (lazily evaluated) stream of As where each element A can depend on previous elements.
As a minimal case, we can take Gen[Stream[Int]] where the next element is either +1 or +2 of the previous…

GuoLiang Oon
- 163
- 6
1
vote
1 answer
How are properties evaluated in eclipse?
Please read with patience, I tried my best to explain the situation, if not please comment -
I have two plugins say A, B. In both of the plugins I defined an "and" expression for a command. One of the conditions in the "and" expression is to test a…

SomeDude
- 13,876
- 5
- 21
- 44
1
vote
1 answer
Create an Arbitrary instance for a case class that holds a `Numeric` in ScalaCheck?
I'm specifically trying to define Semigroup and a Sum type which 'is a' Semigroup and check the Associative property of Semigroup generically using ScalaCheck.
I first wrote this out in Haskell because I find it easier to think of these things first…

josiah
- 1,314
- 1
- 13
- 33
0
votes
0 answers
Are gopter property tests safe for parallel use?
I'm using gopter for property testing and I'm interested in speeding up my test runs by running independent tests in parallel.
I can't find any reference in the documentation as to whether it's safe to call t.Parallel() in my test or not. Though,…

Bevan
- 43,618
- 10
- 81
- 133
0
votes
1 answer
Python property testing with timeout
I have a certain amount of time to test a system. Can I write a Python property test that runs property tests until one hour is up? I looked for a solution in hypothesis but I couldn't find one.
I imagine that property-testing libraries have some…

Matthew Piziak
- 3,430
- 4
- 35
- 49
0
votes
1 answer
How write a property test for particular list content
I have following function, that I want to test it with ScalaCheck:
object Windows {
val Directory = "^[a-zA-Z]:\\\\(((?![<>:\"/\\\\|?*]).)+((?

softshipper
- 32,463
- 51
- 192
- 400
0
votes
1 answer
Generating tuples containing Long for Vavr Property Checking
I need a pair of random longs for property checking with Vavr.
My implementation looks like this:
Gen longs = Gen.choose(Long.MIN_VALUE, Long.MAX_VALUE);
Arbitrary> pairOfLongs = longs
.flatMap(value -> random ->…

MariuszS
- 30,646
- 12
- 114
- 155