Questions tagged [property-based-testing]

144 questions
0
votes
2 answers

Ignore "require" and assertions during tests with ScalaCheck?

Our case classes have several require statements to throw exceptions when they receive malformed input. This is normally pretty helpful, but can make writing property-based tests a pain, since we have to write generators that satisfy all the…
Satvik Beri
  • 271
  • 1
  • 2
  • 9
0
votes
1 answer

Circular Generators hanging indefinately

I have a set of names in a file. I need to implement a Generator that iterates through them continually. However, the code is hanging indefinitely at if (iter.hasNext) after the first pass. Gen code var asStream =…
Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
0
votes
0 answers

Using specs2 + scalacheck to validate type classes (simple Arbitrary[...] example)

I'm having trouble getting specs2 and scalacheck to cooperate. I have a simple class, Credit, that takes a single integer within the range of 1 to 59 (anything outside of this range should throw an exception). I want to define two tests: 1 test that…
Zaphod
  • 1,387
  • 2
  • 17
  • 33
0
votes
1 answer

conditionally running tests with build flags not working

I'm running some tests in golang and I want to avoid running the slow ones, for example this one uses bcrypt so it's slow: // +build slow package services import ( "testing" "testing/quick" ) // using bcrypt takes too much time, reduce the…
Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
0
votes
0 answers

how to use xUnit and FsCheck with IoC and mocking in F#

I want to write unit tests F# using property base testing technic. however I came across several obstacle. Code I want to test is in C# Domain objects come from EF i.e. no constructors only mutable properties sut is a class that will require a…
Icen
  • 441
  • 6
  • 14
0
votes
1 answer

How would I perform property-based testing on a card game's Deal function?

I am studying property-based testing and am curious how I would apply this type of testing to a BlackJack game's Deal function. Here's a unit test (aka: Example-based test): [] let ``deal two cards`` () = let hand = 2 let dealPlayer…
Scott Nimrod
  • 11,206
  • 11
  • 54
  • 118
0
votes
1 answer

Approach to testing with FsCheck

I am trying to make the paradigm shift to FsCheck and random property-based testing. I have complex business workflows that have more test cases than I can possibly enumerate, and the business logic is a moving target with new features being…
John Zabroski
  • 2,212
  • 2
  • 28
  • 54
-1
votes
1 answer

How do I create a Strategy that generates a value in a given range in proptest?

I want to create a Strategy that generates u32 values less than 1000000 efficiently and uniformly. The only two ways that I know to do this are to use any::() and then do one of the following: use prop_filter to filter out values greater than…
nimble_ninja
  • 323
  • 1
  • 13
-1
votes
1 answer

Test Python function raising an Error using Hypothesis

Is there a way to use Hypothesis to check if a Python function raises an Error when a particular set of arguments are passed to it? As in, I want the assert to be True if the function fails and not make the test execution stop and the function…
Pratyush Das
  • 460
  • 7
  • 24
1 2 3
9
10