[erlang-questions] Unit testing

42 views
Skip to first unread message

Yves S. Garret

unread,
Dec 20, 2011, 11:38:52 AM12/20/11
to erlang-q...@erlang.org
Hi all,

   Recently I started working on unit testing for CakePHP and this got met wondering, what unit testing apps are there for Erlang?

   I've found these sources:

   Anything else?  Does anyone know if any Erlang programming books out there cover this topic in some detail?

Yves S. Garret

unread,
Dec 20, 2011, 11:43:54 AM12/20/11
to erlang-q...@erlang.org
Oh and if anyone has personal experience and personal inputs on this subject, that would be awesome and I would love to hear your inputs especially.  After doing software development and learning about the software development process, I've found that -- given the general unreliability of software nowadays -- some (any?) form of testing is highly prized in the software development process.

Kenny Stone

unread,
Dec 20, 2011, 11:59:20 AM12/20/11
to Yves S. Garret, erlang-q...@erlang.org
http://erlcode.wordpress.com/

The Erlang books that I've read don't do a great job covering testing.

Kenny

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


Max Bourinov

unread,
Dec 20, 2011, 12:16:47 PM12/20/11
to Kenny Stone, Yves S. Garret, erlang-q...@erlang.org
Yves, we use eunit. It does it's job very well.

Please, describe your requirements and tell why eunit is not enough for you for further help.

To my xp Eunit is great thing that works very well.

Sent from my iPhone

Gianfranco Alongi

unread,
Dec 20, 2011, 12:18:32 PM12/20/11
to Yves S. Garret, erlang-q...@erlang.org
In general, I would advice you to start from the start on this

http://erlcode.wordpress.com/2010/08/30/erlang-eunit-introduction/

and go on in accordance to the dates.

Cheers
G

Yves S. Garret

unread,
Dec 20, 2011, 12:24:29 PM12/20/11
to Gianfranco Alongi, erlang-q...@erlang.org
Thanks Gianfranco.

Max, I'm curious what Erlang unit testing tools there are.  I like writing code in Erlang, but don't get a chance to do that professionally and had that light-bulb-moment when I was working on something else that needs unit testing.

Magnus Klaar

unread,
Dec 20, 2011, 12:54:49 PM12/20/11
to Yves S. Garret, erlang-q...@erlang.org
Hi!

Didn't see a mention of it yet. LYSE has a really good chapter on EUnit.

MVH Magnus

Joseph Norton

unread,
Dec 20, 2011, 6:41:04 PM12/20/11
to Yves S. Garret, erlang-q...@erlang.org
I'd recommend to use QuickCheck (http://www.quviq.com/and/or PropEr (http://proper.softlab.ntua.gr/) for testing Erlang and non-Erlang applications.  Just in case no one else has mentioned either of these tools to you.

Joseph Norton



Steve Davis

unread,
Dec 20, 2011, 7:41:42 PM12/20/11
to erlang-q...@erlang.org
I suspect that the reason testing is less extensively covered in
erlang is that it's generally easier (less involved) to accomplish.

For apps with little internal state, a simple test() method is usually
considered enough (if you look at what people actually do).

As the system gains more internal state, people move to eunit,
quicktest, test_server etc.

It all depends on what's really necessary in practice (rather than
observing some notional consideration of required ceremony which, in
many circumstances, may be a total waste of everyone's time).

/s

On Dec 20, 10:38 am, "Yves S. Garret" <yoursurrogate...@gmail.com>
wrote:


> Hi all,
>
>    Recently I started working on unit testing for CakePHP and this got met
> wondering, what unit testing apps are there for Erlang?
>
>    I've found these sources:
>

>    1.http://www.erlang.org/doc/apps/eunit/chapter.html
>    2.
>    http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-uni...


>
>    Anything else?  Does anyone know if any Erlang programming books out
> there cover this topic in some detail?
>

> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@erlang.orghttp://erlang.org/mailman/listinfo/erlang-questions

Steve Davis

unread,
Dec 20, 2011, 7:43:39 PM12/20/11
to erlang-q...@erlang.org
wow did i really say test() "method" -- i have spent far too much of
my day in java today.

On Dec 20, 6:41 pm, Steve Davis <steven.charles.da...@gmail.com>
wrote:

David Goehrig

unread,
Dec 20, 2011, 8:23:06 PM12/20/11
to Yves S. Garret, erlang-q...@erlang.org

On Dec 20, 2011, at 11:43 AM, "Yves S. Garret" wrote:

-- given the general unreliability of software nowadays -- some (any?) form of testing is highly prized in the software development process.

---

Well, we use a combination of eunit, some adhoc load generators, and pathogical random event generator scripts. None of this really matters though if you don't properly identify the problem you are solving and characterize the production behavior.

Software testing does little in my experience but confirm apriori bias and serve to limit refactoring necessary for proper engineering. If you find yourself hesitating to write an alternative implementation to test a theory, you've written too many tests.

If you program follow contract based programming practices, and test only well defined interfaces (and not internal details, also referred to as black box testing) you'll get more bang for your buck. But this usually requires versioning all of your API calls.

Hope this helps

Dave

Jesper Louis Andersen

unread,
Dec 22, 2011, 5:13:06 PM12/22/11
to erlang-q...@erlang.org
On 12/21/11 12:41 AM, Joseph Norton wrote:
I'd recommend to use QuickCheck (http://www.quviq.com/and/or PropEr (http://proper.softlab.ntua.gr/) for testing Erlang and non-Erlang applications.  Just in case no one else has mentioned either of these tools to you.

We use PropEr in etorrent currently. We were using QuickCheck until Magnus Klaar changed us to PropEr. We run PropEr from eunit actually, just because it is easier to hook into the tool chain. But this is for internal testing of individual modules.

The other tool we use it Common Test (ct) which is a bit more involved to set up. We use it to spawn a small local BitTorrent network and test that our application can communicate with itself and a foreign BitTorrent client. This tend to weed out many problems right away. The advantage of Erlang is that you can use it through ct to control other applications while you are running tests.

So my approach would be: Internal test => eunit, Large scale blackbox test => CommonTest. And finally, use PropEr or QuickCheck for writing the test cases so you can automatically generate a couple 1000 tests and get your system properly tested.

-- 
Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen, DK
Reply all
Reply to author
Forward
0 new messages