From: Xavier Maillard <xavier@maillard.im>
To: help-gnu-emacs@gnu.org
Subject: Re: TDD and BDD for emacs-lisp
Date: Thu, 28 Apr 2016 23:10:33 +0200 [thread overview]
Message-ID: <m0r3dp1lti.fsf@ll.home> (raw)
In-Reply-To: 877ffh7gx1.fsf@kuiper.lan.informatimago.com
"Pascal J. Bourguignon" <pjb@informatimago.com> writes:
> Xavier Maillard <xavier@maillard.im> writes:
>
>> Hello,
>>
>> for my next project (an IM tool), I would like to try to embrace TDD/BDD
>> methodology. I have never done this before and I even do not know the way I
>> will have to change my coding habits.
>
> For unit tests, there are various emacs lisp test frameworks. It's
> rather easy to write your own too.
Yes, but the idea is not really to reinvent the wheel for me and I'd rather
stick with existing (good) projects if possible.
> However, if you want to perform integration tests, since you are
> implementing a communication tool, you will have to send data from one
> end, and receive it on another end, so, in another process, and check
> that it has been correctly received, etc.
That's the idea. I thought I could /fake/ some part of the tests with
stubs/mocks (I am not sure I understand the difference between these two
beasts though) so that I could simulate data exchange with the external
service. Am I wrong ? Do I really have to test the whole chain ?
> Once I had to test a MTA (SMTP filter), and I was in that situation,
> with messages composed and sent from emacs, and received in another
> process. You may want to filter and test the logs too (check for error
> messages or other events).
Yes, good point.
> In this situation, I know of no test framework helping, and therefore I
> tend to write my own test modules or tools, specific to each situation.
Makes sense.
> Sorry, I cannot help you with code, it was a long time ago, wikis, DCVS
> and things like elpa didn't exist yet!
Oh man, are you that ... o . l . d ? (kidding :D)
[ snip ]
>> With ERT shipped with GNU emacs >= 24, there is no reason not to use it but
>> for BDD, I can see at least 2 (good) tools: ecukes and buttercup. Is there
>> any comparison chart somewhere ?
>
> ERT is made to unit test emacs lisp code. I doubt it would be convenient
> to use when you have asynchronous and communicating processes. So it
> will be applicable only partially (on small local unit tests).
That's the idea. Given I'd rather starting with BDD and then TDD, that's not a
problem. I also want these tests to be the actual documentation/spec for
end-user (not a manual though).
Thank you Pascal.
next prev parent reply other threads:[~2016-04-28 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1236.1461826513.7477.help-gnu-emacs@gnu.org>
2016-04-28 17:59 ` TDD and BDD for emacs-lisp Pascal J. Bourguignon
2016-04-28 21:10 ` Xavier Maillard [this message]
2016-04-28 6:50 Xavier Maillard
2016-04-28 16:06 ` Phillip Lord
[not found] ` <mailman.1320.1461859606.7477.help-gnu-emacs@gnu.org>
2016-04-28 21:05 ` Xavier Maillard
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=m0r3dp1lti.fsf@ll.home \
--to=xavier@maillard.im \
--cc=help-gnu-emacs@gnu.org \
/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.