how to run only 1 test ?

271 views
Skip to first unread message

r/ Wobben

unread,
Sep 4, 2015, 9:08:13 AM9/4/15
to Midje
Hello,

Here a example of a test I have to use for a online course.

Geef de code hier op...

(facts
"do-a-thing" {:exercise 1
:points 1} (do-a-thing 3) => 46656.0 (do-a-thing 1) => 4.0 (do-a-thing 0) => 1.0)

Is there a way I can only run this test
I tried lein midje :filter exercise 1
but that one fails.

Roelof

r/ Wobben

unread,
Sep 4, 2015, 9:32:38 AM9/4/15
to Midje
Here again the test because the markup messed things up.

facts "do-a-thing" {:exercise 1 :points 1}


Roelof

Op vrijdag 4 september 2015 15:08:13 UTC+2 schreef r/ Wobben:

Brian Marick

unread,
Sep 5, 2015, 6:20:33 PM9/5/15
to mi...@googlegroups.com


r/ Wobben wrote:
> Is there a way I can only run this test
> I tried lein midje :filter exercise 1
> but that one fails.

I answered this on the clojure mailing list. For reference:


I *strongly* recommend doing all your testing in a repl buffer. That
given, there are two ways to solve your problem. The first, which I
prefer, is to start by testing everything:

(use 'midje.repl)
(autotest)

Then, when you change any text and save the namespace it's in, all tests
that depend on that namespace will be rerun, including the one you're
specifically working on.

The other alternative is to rerun your specific test with something like:

(check-facts #"fact description")

... or, once you've run a specific fact:

(recheck-fact)

r/ Wobben

unread,
Sep 6, 2015, 11:48:42 AM9/6/15
to Midje
Thanks,

What if you use lein midje
and what is the fact in my example.

Roelof


Op zondag 6 september 2015 00:20:33 UTC+2 schreef Brian Marick:

r/ Wobben

unread,
Sep 6, 2015, 1:56:09 PM9/6/15
to Midje
I did what you want but no luck.

Here the output I see :

user=> (autotest)
====================================================================== Loading (training-day-test training-day) Exception No namespace: training-day-test found clojure.core/the-ns (core.clj:3760)


Exception No namespace: training-day-test found  clojure.core/the-ns (core.clj:3760)
user=> (use 'midje.repl)
nil
user=> (autotest)
======================================================================
Loading (training-day-test training-day)
Exception No namespace: training-day-test found  clojure.core/the-ns (core.clj:3760)

The test file exist of this :

ns training-day-test (:use iloveponies.tests.training-day))

Roelof


ception No namespace: training-day-test found  clojure.core/the-ns (core.clj:3760)
user=> (use 'midje.repl)
nil
user=> (autotest)
======================================================================
Loading (training-day-test training-day)
Exception No namespace: training-day-test found  clojure.core/the-ns (core.clj:3760)


Op zondag 6 september 2015 17:48:42 UTC+2 schreef r/ Wobben:

r/ Wobben

unread,
Sep 6, 2015, 3:57:26 PM9/6/15
to Midje
Hello,

I tried another time with first lein midje and  now everything works.

The only thing I mentioned if I change a file and saved it I often see a message that
No facts were checked. Is that what you wanted?

then I say true and do another time (check-facts ...) and I see the right outcome.

Roelof



Op zondag 6 september 2015 19:56:09 UTC+2 schreef r/ Wobben:

Brian Marick

unread,
Sep 7, 2015, 5:21:40 PM9/7/15
to mi...@googlegroups.com
When you save a file, `autotest` notices that the file has changed. It reloads that file and any files depend on it. If you're seeing the "no facts were checked" message, that's because there were no `fact` statements in any of the files that were loaded.

r/ Wobben wrote:
> Hello,
>
> I tried another time with first lein midje and now everything works.
>
> The only thing I mentioned if I change a file and saved it I often see
> a message that
> No facts were checked. Is that what you wanted?
>
> then I say true and do another time (check-facts ...) and I see the right outcome.
>
> Roelof
>
>
>
> Op zondag 6 september 2015 19:56:09 UTC+2 schreef r/ Wobben:
>
> I did what you want but no luck.
>
> Here the output I see :
>
> ||
> user=>(autotest)
> ======================================================================Loading(training-day-test
> training-day)ExceptionNonamespace:training-day-test found
> --
> You received this message because you are subscribed to the Google
> Groups "Midje" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to midje+un...@googlegroups.com
> <mailto:midje+un...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages