Sun May 22 20:12:05 CEST 2011
On Mon, 23 May 2011 03:57:15 +1000, Edmond Begumisa
> On Sun, 22 May 2011 16:15:59 +1000, Anthony Molinaro
> <anthonym@REDACTED> wrote:
>> On Sun, May 22, 2011 at 08:01:09AM +1000, Edmond Begumisa wrote:
>>> 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!
>> I'm mostly a noob myself, but I have used both quickcheck and proper
>> and figured anything helps when you're just learning these tools.
>>> 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.
>> The one thing to remember is that there are many types of testing
>> and quickcheck/proper focus on randomized testing of properties.
>> Getting you head around testing in that fashion can be a challenge,
>> it forces you to think about generating random data for which you
>> know the answer. Quickcheck and proper excel at problems where
>> you have a function and it's reverse (like encode and decode), because
>> the property of decode (encode (Data)) == Data is pretty easy to setup,
>> you just supply random Data and let it run for a few hundred thousand
>> tests. For other functions where you don't have an inverse the trick
>> is knowing the answer when you give it random data (at least this
>> is what I've found with my limited use of these tools).
>> Other testing frameworks like eunit or common_test may be more of
>> what you are looking for, but it really depends on what you are
>> testing. If you have a general description of the code, I might
>> be able to make some suggestions, but its hard to say without
>> know what you are trying to test
> Firstly, I have a few general purpose libraries. Mainly extensions to
> existing standard libraries like my_lists.erl, my_binaries.erl,
> my_proplists.erl, etc. Auto-testing these is probably not that
> important. But my guess is it would be a good place to start for
> Secondly, I also have a TCP socket application that's designed to have
> pluggable codecs. The idea being I can just plugin a module called
> http_codec.beam, and the socket server starts doing http. Then I can
> plugin websocket_codec.beam on top of that and it starts doing websocks
> over http. Then I can remove those and plugin ubf_codec.beam, and it
> starts doing UBF over TCP. You get the picture.
> The socket server is the usual multi-acceptor (gen_server), spawn new
> connections (gen_fsm) setup. The codecs are just plain modules with
> decode/encode functions that continue from where they last left off. I
> really want to test this coz it's at the center of all the apps I'm
> developing and frequently misbehaves in annoying little ways that I
> should have foreseen but don't realise til it actually happens (little
> perfect storms creep up on me.) I figure automated testing is they only
And I also figured I could use QuickCheck/PropEr to create these scenarios
that I can't seem to foresee!
- Edmond -
> Thirdly, most of the products I'm working on make heavy use of state
> machines that sit on top of the socket toolkit described above. These
> are application specific and need testing too. Oh, and these interact
> frequently with CouchDB.
> That's the basic picture. I want to start testing ALL of this :P Any
> more tips would be great.
> - Edmond -
>>> 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?
>> There are a few nice examples here
>> There are also a few videos and other things if you search for
>> erlang quickcheck tutorial on your favorite search engine.
>> Hope that helps,
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the erlang-questions