[erlang-questions] QuickCheck/PropEr
Edmond Begumisa
ebegumisa@REDACTED
Mon May 23 21:24:53 CEST 2011
Thanks John,
This was most helpful and got me over that initial hurdle. I see now that
property-based testing is more about defining how the system should behave
and is best used as a design-time aid -- almost like programming by
contract. Write properties first, code from there. Thinking of it the
other way had caused me great confusion.
With some head-scratching, I can now (usually) retrospectively come up
with properties for my libraries and codecs after watching this.
But now I have a different problem! Libraries and codecs were at the
bottom of my list for things I wanted to do automated tests on coz these
don't fail much (time constrains mean I can ignore them for now). State
machines and IPC are at the top. I know -- I'm jumping straight into the
deep end. But I need to test the complex stuff in my apps rather than the
simpler stuff!
Knowing that these are features for the commercial version of QuickCheck,
I'll direct the following silly questions to PropEr users instead:
* proper_fsm now makes more sense (reminds me a little of UBF(C)). But I'm
having trouble with defining properties for my gen_servers. From what I
can tell, I need to somehow use {set, {var, _}, {call, _}} symbolic reps
for the callbacks. Something I realised from watching ...
http://www.quviq.com/demos/QuickCheck%20Elevator%20Demo/QuickCheck%20Elevator%20Demo.htm
.. and from "Testing Stateful Code" in PropEr's README. But I can't figure
out how to actually write the properties with symbolic reps for the
callbacks. Can anyone offer me an example on how to do this?
* If I want to test a group of modules/processes rather than just one.
Specifically, a subtree in my supervision tree. How would I go about doing
this? Using the elevator example: say elevator.erl spawns several people
processes defined by person.erl. I write properties for both modules and
test them individually. But if I want to then write properties that depend
on actual interaction between elevator.erl and several person.erl
processes, where would I start?
Thanks in advance for any help.
- Edmond -
On Sun, 22 May 2011 20:20:06 +1000, John Hughes <john.hughes@REDACTED>
wrote:
> Hi Edmond,
>
> You're not alone--there is a hurdle to get over, a different way of
> thinking about testing. My talk at the last Erlang Factory in SF was
> specifically intended to help people just starting out--the video and
> slides are on the web at
> http://www.erlang-factory.com/conference/SFBay2011/speakers/JohnHughes.
> Be interested to hear if you find it helpful/not helpful.
>
> John
>
>
> ----- Original Message ----- From: "Edmond Begumisa"
> <ebegumisa@REDACTED>
> To: <erlang-questions@REDACTED>
> Sent: Sunday, May 22, 2011 12:01 AM
> Subject: [erlang-questions] QuickCheck
>
>
>> Hello all,
>>
>> I'm a QuickCheck noob trying out PropEr. Actually, I'm very embarrassed
>> to admit that I'm very new to formal testing in general (I've always
>> done things in the ad-hoc way for longer than I care to admit). I only
>> confess to this coz I probably wouldn't get away with lying about it on
>> *this* list when I start asking stupid questions!
>>
>> Anyways, I'm having A LOT of trouble getting started. The initial
>> inertia just isn't there. Even with the available documentation from
>> both QuviQ and PropEr. I look at my code and don't know where to begin
>> writing tests for it! A sad state of affairs.
>>
>> I think I just need a few good tutorials. Can anyone recommend some
>> QuickCheck resources to get me going that they've actually successfully
>> used? Do I need to first start out with more "traditional" testing
>> tools first before even attempting QuickCheck?
>>
>> Thanks in advance for you help.
>>
>> - Edmond -
>>
>> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the erlang-questions
mailing list