all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Ohler <ohler+emacs@fastmail.net>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Nikolaj Schumacher <me@nschum.de>,
	web@shellarchive.co.uk,
	Lennart Borgman <lennart.borgman@gmail.com>,
	Masatake YAMATO <yamato@redhat.com>,
	joakim@verona.se, emacs-devel@gnu.org,
	rubikitch <rubikitch@ruby-lang.org>,
	Phil Hagelberg <phil@hagelb.org>
Subject: Re: unit test framework
Date: Sat, 12 Jun 2010 16:06:45 +1000	[thread overview]
Message-ID: <4C1323F5.80301@fastmail.net> (raw)
In-Reply-To: <m3y6gr1w3c.fsf@verona.se>

joakim@verona.se, 2010-04-13:

> Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> 
>>> I write try to write unit tests for my elisp, and it would be much
>>> easier if there was a canonical unit test framework in Emacs.
>> Yes, that's the intention.  We should pick one and run with it.
>> The choice doesn't have to be "the very best", but it should aim for:
>> - simple&clean code, easy to maintain&extend.
>> - well maintained with a maintainer interested in taking a lead helping
>>   us integrate it into Emacs.
>>
>>
>>         Stefan
> 
> I've now tested "elunit" and converted to "ert". So far I prefer "ert"
> because its available in ELPA, and the report looks like the ones I'm
> used to get with JUnit or something similar.
> 
> OTOH none of the packages reported exactly where in my code my errors
> where. "ert" was slightly better tough.
> 
> Just my €0.02, to get the thread going again. Again, to quote Stefan, we
> should just pick something and run with it. I'm sure Emacs will
> improve from it.

I was very busy and missed this whole thread.  Sorry.  I assume no 
conclusion has been reached?

It seems that ert has a few supporters already.  I had a look at the 
other frameworks, and while things like mocking support and perhaps 
elk-test's fringe markers could be nice to add on top, I am fairly 
confident that ert has the most useful core, by which I mean basic 
functionality like defining and running tests and presenting failures in 
a (somewhat) comprehensible way.

For example, it has a `should' macro to express assertions that 
generalizes the `assert-eq', `assert-equal' etc. macros in elk-test, and 
installs a debugger hook rather than catching errors with condition-case 
so that it can capture backtraces of errors in tests.  Features like 
these add a little bit of complexity to ert's code, but they simplify 
testing and debugging other code, so they are worthwhile.

Unlike some other frameworks, ert does not dictate any particular style 
of testing; its deftest is very similar to defun, and tests can be 
stateful or functional as needed.  It was designed for Emacs Lisp and 
fits nicely into it rather than imitating frameworks from other 
environments.

It does not yet include utilities for testing Emacs state such as window 
layouts and buffer contents with text properties, or user input, but 
such utilities are orthogonal to the basic test execution framework and 
can be added incrementally.  I think Lennart has some of this already in 
his fork.

I don't know if the code qualifies as well-maintained; I haven't touched 
it in a while, since no bugs have been reported, but I haven't been very 
good at accepting patches to add features, either.  (Sorry Yamato-san, 
I'll look at your patch today.)  On the other hand, the other frameworks 
have been dormant for long periods as well.


I have some spare time now and can offer to work on integrating ert into 
Emacs; any suggestions where to start?  Where does a file like ert.el 
belong?  Where should the corresponding tests go?  Should I try to 
change makefiles to let tests run automatically during build?

My employer has a blanket copyright assignment.  Please contact me 
off-list if this needs further discussion.

Christian.




  reply	other threads:[~2010-06-12  6:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  7:39 unit test framework Masatake YAMATO
2010-03-18  9:31 ` Lennart Borgman
2010-03-18 10:07   ` Leo
2010-03-18 10:23     ` Lennart Borgman
2010-03-18 11:25     ` Masatake YAMATO
2010-03-18 14:22 ` Stefan Monnier
2010-03-18 14:56   ` Lennart Borgman
2010-03-19  0:16     ` rubikitch
2010-03-19 19:00     ` Phil Hagelberg
2010-03-20 11:01     ` Nikolaj Schumacher
2010-03-23  9:02     ` joakim
2010-03-23 13:15       ` Lennart Borgman
2010-03-24  3:03         ` Masatake YAMATO
2010-03-23 14:22       ` Stefan Monnier
2010-04-13 10:32         ` joakim
2010-06-12  6:06           ` Christian Ohler [this message]
2010-06-12 13:48             ` Lennart Borgman
2010-06-14 11:24             ` Masatake YAMATO
2010-07-23 21:58             ` Stefan Monnier
2010-03-23 10:15     ` Philip Jackson
2010-06-27 18:50   ` Philip Jackson
2010-07-09 13:43     ` Christian Ohler
2010-07-09 23:01       ` Glenn Morris
2010-07-10  1:12         ` Christian Ohler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C1323F5.80301@fastmail.net \
    --to=ohler+emacs@fastmail.net \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    --cc=lennart.borgman@gmail.com \
    --cc=me@nschum.de \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=phil@hagelb.org \
    --cc=rubikitch@ruby-lang.org \
    --cc=web@shellarchive.co.uk \
    --cc=yamato@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.