How to to watch changed files and run tests again automatic

375 views
Skip to first unread message

Denis L

unread,
Apr 9, 2015, 9:55:36 AM4/9/15
to clo...@googlegroups.com
I use Rspec/Guard to watch changed files and automatic run test for for Ruby/Rails application.
How can I repeat similar scenario for Clojure-app?

Colin Yates

unread,
Apr 9, 2015, 9:56:47 AM4/9/15
to clo...@googlegroups.com

Lein-test-refresh works well

On 9 Apr 2015 14:55, "Denis L" <sad....@gmail.com> wrote:
I use Rspec/Guard to watch changed files and automatic run test for for Ruby/Rails application.
How can I repeat similar scenario for Clojure-app?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Juvenn Woo

unread,
Apr 9, 2015, 9:59:53 AM4/9/15
to clo...@googlegroups.com, clo...@googlegroups.com
Hi Denis, there's lein-auto plugin can do that.


Sent from Mailbox


On Thu, Apr 9, 2015 at 9:55 PM, Denis L <sad....@gmail.com> wrote:

I use Rspec/Guard to watch changed files and automatic run test for for Ruby/Rails application.
How can I repeat similar scenario for Clojure-app?

--

Jake McCrary

unread,
Apr 9, 2015, 9:34:16 PM4/9/15
to clo...@googlegroups.com
Depending on what testing library you are using there are different answers.

The built-in clojure.test has lein-test-refresh, prism, and quickie. Of the three I use lein-test-refresh (though, I'm also the author of it so I'm a bit biased). The expectations library has lein-autoexpect (I'm also the author of lein-autoexpect). Midje has it built-in. You can run continuously test from a repl or using lein-midje.

Both lein-test-refresh and lein-autoexpect support notifying in various ways when your tests finish running. All of the tools mentioned above monitor your files and when something changes they reload the affected namespaces and then rerun your tests.

lein-auto can also be used to run a Leiningen task when a file changes. Its a bit different than the above tools in that it doesn't directly reload the modified namespaces but instead runs a Leiningen task. Since it can trigger any Leiningen task lein-auto is more flexible. If your goal is to minimize feedback time you'll want to use one of the above tools though as they provide a significantly shorter feedback cycle.

Denis Larionov

unread,
Apr 10, 2015, 11:51:15 AM4/10/15
to clo...@googlegroups.com
Great! Thanks!

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Jacobsen

unread,
Apr 11, 2015, 8:35:53 AM4/11/15
to clo...@googlegroups.com
If you're used to Rspec, have a look at Speclj.[1]  It's somewhat Rspec-like.  Its -a option does the same as lein midje :autotest, and works better for some situations.

In my experience, the different testing frameworks each have their warts and nice features -- it's worth trying more than one.




On Thursday, April 9, 2015 at 8:55:36 AM UTC-5, Denis L wrote:
Reply all
Reply to author
Forward
0 new messages