I use emacs & expectations[1]

These days I do more repl-driven-development than
test-driven-development, so the tests tend to come after solving the
problem at hand. At that point I run all the tests via "lein
expectations"[2] to get an idea of what's broken. Now that I know what
test namespaces contain broken tests, I'll open those namespaces in
emacs and execute them individually with expectations-mode[3]. One
execution makes it clear which tests are broken, and my next step is
to fix the existing tests. Once that's done, I take a look at my
current changes, and determine if any new tests need to be written.

A few friends of mine prefer a more continuous testing style, which is
also possible if you use lein-autoexpect[4]. One of my friends wrote
up his experiences on continuous testing here:
http://jakemccrary.com/blog/2011/12/16/continuous-testing-with-clojure-and-expectations/

I would say above all, you should try out all the tools that are
available to you, and find out what works best for you. The
testing/coding flow seems to vary greatly by person, so what's "most
effective" will largely be driven by you, not by the tools.

[1] http://jayfields.com/expectations/
[2] https://github.com/gar3thjon3s/lein-expectations
[3] https://github.com/gar3thjon3s/expectations-mode
[4] https://github.com/jakemcc/lein-autoexpect

On Sat, Jan 25, 2014 at 12:57 AM, Alexandr Kurilin <a...@kurilin.net> wrote:
> I've been running my app's tests through `lein test` (most often for
> specific namespaces) for a long time now, but after reading Leiningen's
> recommendation to run them from the REPL I decided I should figure out how
> to make this happen.
>
> I've heard a few options on this subject, and would love to know what you
> yourselves use. A couple I stumbled upon were:
>
> In your favorite editor with nrepl/cider, do some work in the ns you're
> testing, reload it from within the editor, then switch to the testing ns and
> run (clojure.test/run-tests) from within. Then when you're done with your
> work, run a `lein test` just in case your state while nrepling in was
> corrupted or another ns was affected etc.
> Use your favorite editor with nrepl/cider to work on the app's ns, but then
> switch to a repl started within `lein repl` in which you're only running
> tests. This potentially helps with a slightly cleaner state. (I'm not clear
> how you'd reload the app's ns without the hassle of having to always
> (require) the right set of changed nses)
> In a new `lein repl`, use bultitude, load all test nses, use
> clojure.test/run-all-tests with the right regex. Like `lein repl`, minus
> having to spin up a new JVM every time.
>
> I'm currently playing around with the first approach. I'd love to know if I
> missed something much more effective, or if I can make this a bit simpler
> and less manual. Tips would be greatly welcome.
>
> Cheers!
>
>
> --
> Alexandr Kurilin
> 206.687.8740 | @alex_kurilin | blog
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to