From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xavier Maillard Newsgroups: gmane.emacs.help Subject: Re: TDD and BDD for emacs-lisp Date: Thu, 28 Apr 2016 23:10:33 +0200 Organization: A noiseless patient Spider Message-ID: References: <877ffh7gx1.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1464881124 8687 80.91.229.3 (2 Jun 2016 15:25:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:25:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 17:25:24 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b8UUp-0007V7-Cp for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 17:25:19 +0200 Original-Received: from localhost ([::1]:48012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8UUo-0006TT-Bo for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 11:25:18 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!feeder1.xsusenet.com!feeder2.usenet.farm!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Injection-Info: mx02.eternal-september.org; posting-host="d979e6b3555cfd8d6df644de4e29a754"; logging-data="16627"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/Tozj4/2ke+9yLqyOED3Y" User-Agent: Gnus (5.13), GNU Emacs 24.5.1 (x86_64-apple-darwin15.3.0) X-Accept-Language: en, fr Cancel-Lock: sha1:4qtAbRRLY+D8OfLvc0dtkJJimEI= sha1:7TxMsb9V4Ls4cfWFpKPxsWsLhAU= X-GPG-FINGERPRINT: 9983 DCA1 1FAC 8DA7 653A F9AA BA49 09B7 8F04 DE1B X-Home-Page: https://xavier.maillard.im X-GPG: 0xBA4909B78F04DE1B Original-Xref: usenet.stanford.edu gnu.emacs.help:217545 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110169 Archived-At: "Pascal J. Bourguignon" writes: > Xavier Maillard 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.