all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: TDD and BDD for emacs-lisp
Date: Thu, 28 Apr 2016 19:59:54 +0200	[thread overview]
Message-ID: <877ffh7gx1.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.1236.1461826513.7477.help-gnu-emacs@gnu.org

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.

https://www.emacswiki.org/emacs/UnitTesting

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.

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).

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.

Sorry, I cannot help you with code, it was a long time ago, wikis, DCVS
and things like elpa didn't exist yet!


Reusable frameworks are nice when you are doing repeatitively the same
kind of work…


> I have looked here and there to see if it is something emacs-lisp hackers
> do, it seems that it has not spread much.
>
> So, what tool(s) do you use if you do your devs using TDD/BDD ? Do you have
> simple examples to share ? Is it recommended to do both ? Where does one
> shine more than another ? etc. (I will probably have to read tons of
> documentation but that's fine).
>
> 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).


> Any help would be appreciated to start using TDD/BDD.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


       reply	other threads:[~2016-04-28 17:59 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 ` Pascal J. Bourguignon [this message]
2016-04-28 21:10   ` TDD and BDD for emacs-lisp Xavier Maillard
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=877ffh7gx1.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --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.