Yeah, the easiest way is to generate attributes and instantiate any Rails model like the one below:
Pbt.assert do
Pbt.property(name: Pbt.printable_string, age: Pbt.integer(min: 0, max: 100)) do |name:, age:|
user = User.new(name: name, age: age)
# write your test here
end
end
>yes, because you're changing the order in which the random draws are interpreted. But this isn't a problem in practice because you generally aren't changing the generator in the middle of debugging a failure.
Correct. The test inputs are determined by a seed and generators (including the order of generators).
In my opinion, PBT should be used in combination with example-based testing. Besides, since example-based testing cases account for the majority of tests, I think it's rare that PBT's execution time is dominant.
https://speakerdeck.com/ohbarye/unlocking-potential-of-prope...
Speaking of my personal story, I used the fast-check documentation and Fred Herbert's book (their links are in the README) to study.