<p dir="ltr">My problem with cucumber is not the idea of a high-level DSL for tests. Au contraire--I think this is a perfect place for a little language. I could easily see a similar tool being useful for Haskell.</p>
<p dir="ltr">Rather, my issue is with the syntax. Not gherkin in particular but rather languages that try to look like English in general. For one, these languages tend to hit the uncanny valley--they&#39;re somewhat natural, but not entirely. Perhaps the code reads like poorly written prose, but you certainly can&#39;t write it in a natural fashion!</p>

<p dir="ltr">More importantly, I do not think prose is a good format for this sort of thing at all. It&#39;s good for reading code, but I almost never read code directly. Instead, I usually look over large parts of code at a time. I want code where I can get the structure at a glance and easily separate the parts that are specific to the current application from ones that aren&#39;t. With prose-like syntax, this is very difficult because everything is made of words. That programming language syntax you dismiss as line noise? It&#39;s actually the structure of the code, which makes it much *faster* to read!</p>

<p dir="ltr">There&#39;s a reason mathematicians user equations and diagrams so much. A single equation can replace literally pages of text, and you can have a pretty good idea of what&#39;s going on without having to look too closely at all the details. Think about an integral, for example: from the equation, you can easily see what sort of equation it is (trigonometric, polynomial, exponential...), what domain you&#39;re integrating over, what the limits are and, very importantly, that it *is* an integral rather than something completely different. All just from what the equation looks like, before you&#39;ve had to expend much attention on it.</p>

<p dir="ltr">One way to think about it is that the notation factors out the repeated parts of an integral so that it&#39;s easy to visually separate from the &quot;meat&quot;--the function you&#39;re actually integrating. A good DSL uses symbols to do the same thing.</p>

<p dir="ltr">The main cost, of course, is that you have to learn the notation. But this is really a one-time cost; if you&#39;re going to be seeing a lot of integrals, it&#39;s more than worth doing, especially because there&#39;s so much shared structure between them. Similarly, it&#39;s worth doing for tests, for the same reasons. There&#39;s a lot of shared structure--just look at how many relatively long phrases got repeated even in the simple examples given here--and you want to look over that structure without actually reading it. Much easier with actual syntax than prose. In any real app, you will have hundreds of tests, and learning to deal with the &quot;line noise&quot; gets amortized over all of them, whereas the benefits (shorter code that&#39;s easier to scan) scale at least linearly.</p>

<p dir="ltr">So I think we should really avoid the faux-natural-language syntax as much as possible.</p>
<div class="gmail_quot&lt;blockquote class=" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I just want to chime in to defend Cucumber, which I use in Ruby at my day job. I see a lot of people put up the strawman that it can only be used as a way for business people to write acceptance tests. That idea is questionable and I&#39;ve never worked at a company big enough to require that, or with business people who have ever wanted to write my tests for me.<div>

<br></div><div>In Ruby, I use Cucumber purely for myself to drive high level acceptance tests for products. I think the sweet spot for it is when you&#39;re starting work on a high level feature and you have NO idea how it will be implemented or even how it will work in detail. I find that writing in the limited language that Gherkin provides keeps my brain from going right to implementation details. I write out tests that explore how the system should work. I write them in the perspective of the user (which you should be doing in your head regardless because the user is the one who will actually interact with your program). I then read them back and make sure they make logical sense. Only then do I start hooking up the steps I wrote to code that drives integration/acceptance tests, via a browser for instance. At the end I have a failing cucumber test that describes the system in an intuitive manner with zero line noise (programming language syntax). I am now free to think about implementation details, write lower level unit tests and implement things that can be described in much less verbose fashion. I really like that process and if I ever had a job to develop products in Haskell, I&#39;d probably take a similar approach.</div>

<div><br></div><div>Do note that I advocate using Cucumber to create/drive user stories, not to unit test low level functions like folds. If you don&#39;t have a customer of a particular function who could describe how they interact with it in layman&#39;s term, then Cucumber is the wrong tool. Use quickcheck/hunit/hspec for that.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito <span dir="ltr">&lt;<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Have you tried AppleScript? I wouldn&#39;t say it&#39;s pleasant to use, but it&#39;s easy to read. <div><div><br><br>On Thursday, September 12, 2013, David Thomas  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">I&#39;ve long been interested in a scripting language designed to be spoken.  Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.<br></div><div class="gmail_extra">



<br><br><div class="gmail_quote">On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <span dir="ltr">&lt;<a>andreas.abel@ifi.lmu.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div>
<p>+1</p>
<p>Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software.  You can program thus without having to use you fingers.  You can lie on your back on your sofa, close your eyes, and utter your programs...</p>




<p>We could have blind Haskell/Cucumber programming contests...</p>
<p>Tons of new possiblilities...</p>
<p>Strongly support this proposal. ;-)</p>
<p>Andreas</p><div><div>
<p>On 2013-09-10 22:57, Artyom Kazak wrote:</p>
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px;width:100%">
<pre>On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri &lt;<a>evohunz@gmail.com</a>&gt; wrote:</pre>
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px;width:100%">I hope these jokes do not cause people to be afraid to post new ideas.</blockquote>
<pre>Agreed. I would also like to clarify that my message was much more a joke  
on
the incomprehensibility of legal acts than on the original proposal.

By the way, I am pretty impressed with this piece of Cucumber  
description/code:

   Scenario: Mislav creates a valid task with an upload
     When I go to the &quot;Awesome Ruby Yahh&quot; task list page of the &quot;Ruby  
Rockstars&quot; project
     When I follow &quot;+ Add Task&quot;
     And I fill in &quot;Task title&quot; with &quot;Ohhh upload&quot;
     And I follow &quot;Attachment&quot;
     When I attach the file &quot;features/support/sample_files/dragon.jpg&quot; to  
&quot;upload_file&quot;
     And I press &quot;Add Task&quot;
     And I wait for 1 second
     And I should see &quot;Ohhh upload&quot; as a task name

I was much more sceptical when I had only seen the example in Niklas’s  
message.
_______________________________________________
Haskell-Cafe mailing list
<a>Haskell-Cafe@haskell.org</a>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
</blockquote>
<p> </p>
</div></div><span><font color="#888888"><div>
<pre>-- 
Andreas Abel  &lt;&gt;&lt;     Du bist der geliebte Mensch. 

Theoretical Computer Science, University of Munich <a href="http://www.tcs.informatik.uni-muenchen.de/%7Eabel/" target="_blank">http://www.tcs.informatik.uni-muenchen.de/~abel/</a></pre>
</div>
</font></span></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a>Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Michael Xavier<br><a href="http://www.michaelxavier.net" target="_blank">http://www.michaelxavier.net</a>
</div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></div>