testing

Testing tools, testing philosophy & methodology...
2015-08-19T01:09:36.000068Z

@nberger: We're using Speclj, my coworker wrote it and our app was the first project it was used in, like a testing ground.

nberger 2015-08-19T11:05:47.000069Z

@sdegutis cool. Are you happy with it? I see it has its own assertion fns/macros (should, should-not)... Do you sometimes have to use clojure.test or you can "do everything" with speclj?

nberger 2015-08-19T11:08:10.000070Z

Also: does lein spec run clojure.test tests, or just specs?

2015-08-19T12:25:00.000071Z

@nberger: We use Speclj exclusively, so we only run our specs. I only use describe, it, and should=, I don't make use of any other Speclj features.

2015-08-19T12:25:30.000072Z

@nberger: For the most part, I really like how the output is formatted, it reminds me of RSpec a lot. I haven't found any other testing framework's output to be as nice.

2015-08-19T12:25:56.000073Z

@nberger: There are a few bugs I encounter sometimes in our codebase, but they've been closed in the Speclj repo as "cannot reproduce" which gives me little hope they'll be fixed.

nberger 2015-08-19T12:44:55.000074Z

@sdegutis: Have you tried clojure.test + humane-test-output? It's a great improvement from plain clojure.test

nberger 2015-08-19T12:46:09.000075Z

http://jakemccrary.com/blog/2014/06/22/comparing-clojure-testing-libraries-output/ has a nice comparison of output from different testing libraries, it's more than 1 year old but I guess not much has changed

nberger 2015-08-19T12:51:10.000077Z

From the comments I see that when the author wrote it, he didn't know about should== in speclj, so the comparison is not 100% fair on speclj. But at the same time, it's a pitty that you have to use a different fn to get a nice deep comparison

2015-08-19T12:57:03.000078Z

@nberger: Thanks for the tip, I'll look into that.

2015-08-19T12:57:14.000079Z

@nberger: Do you use an auto-test-re-runner for clojure.test?

nberger 2015-08-19T13:01:04.000080Z

Not for clojure.test, yes for cljs.test.

nberger 2015-08-19T13:01:45.000081Z

For clojure.test, most of the times I run the tests in the repl, using keyboard shortcuts, and I'm happy with that, most of the times :simple_smile:

2015-08-19T13:03:20.000082Z

Ah.

2015-08-19T13:04:08.000083Z

We have the entire server (top to bottom) tested in what could be considered half-unit / half-integration tests. So anytime we make a change in any line of code, it's useful to run any tests that may be affected (sometimes almost all of them).

nberger 2015-08-19T13:08:41.000084Z

Yes, that's nice... except when it's difficult to say which tests may be affected, or when you don't want to wait for the entire test suite to run

nberger 2015-08-19T13:14:13.000085Z

Many times when I had autotest workflows setup and working, mostly with rspec+guard, I wanted to turn it off, because it would run more tests than I wanted to

2015-08-19T13:16:16.000086Z

Likewise, many times tests failed in unexpected parts of my code due to a bug in my changes.

2015-08-19T13:16:21.000087Z

:simple_smile:

nberger 2015-08-19T13:18:24.000088Z

Yes. Or perhaps your test suite takes more than say 2 seconds (or 2 minutes :/). I like it more to have easy ways to run a specific test, an entire test file, or the entire suite, at the tip of my fingers

2015-08-19T13:20:32.000089Z

:simple_smile:

2015-08-19T13:31:39.000091Z

I like that blog post.

nberger 2015-08-19T14:11:19.000092Z

I guess we should invite @jakemcc here :simple_smile:

jakemcc 2015-08-19T14:15:48.000094Z

@sdegutis: glad to hear it

jakemcc 2015-08-19T14:17:04.000095Z

its a bit dated by now, could probably refresh it and also show Flare https://github.com/andersfurseth/flare

jakemcc 2015-08-19T14:17:38.000097Z

though, besides that I’m not sure if test output has really changed much in the last year

nberger 2015-08-19T14:21:01.000098Z

@jakemcc: didn't know about flare, will check it out later, thanks

jakemcc 2015-08-19T14:21:54.000099Z

no problem. I still prefer humane-test-output but use flare on one project just to keep an eye on it

jakemcc 2015-08-19T14:24:26.000100Z

@nberger: if you end up trying Flare, I’d recommend using (install {:expected :first}) to bring it inline with what humane-test-output and clojure.test documenation show about expected vs actual ordering in assertions. https://github.com/andersfurseth/flare/issues/2

2015-08-19T14:26:37.000102Z

I would have liked Expectations the best, except that it doesn't allow me to give my tests string-descriptions and see these in the output.

2015-08-19T14:27:03.000103Z

I would have liked clojure.test with humane-test-output second-best, except that it only lets me name tests with valid symbols, not strings.

nberger 2015-08-19T14:33:16.000104Z

:simple_smile:

nberger 2015-08-19T14:33:28.000105Z

@jakemcc cool, thanks!

2015-08-19T15:13:01.000106Z

@jakemcc: You didn't mention color in your blog post. humane-test-output isn't colorizing my output 😢

jakemcc 2015-08-19T17:16:59.000107Z

@sdegutis: yeah, probably shows my bias towards not paying attention to color. At this point I only even look at output if there is a failure

2015-08-19T17:17:34.000108Z

Me too, but red is a quick indication that there's an error when 700 test results are flying by.

jakemcc 2015-08-19T17:42:10.000109Z

@sdegutis: not sure if you’re using lein-test-refresh for auto-running, but if you do you can silence the noisy clojure.test output with a configuration flag. https://github.com/jakemcc/lein-test-refresh/blob/master/sample.project.clj#L24

jakemcc 2015-08-19T17:42:19.000111Z

so much nicer

2015-08-19T17:44:51.000112Z

@jakemcc: I haven't used any of these auto-refreshers for clojure.test because of https://github.com/jakemcc/lein-test-refresh/issues/15

2015-08-19T20:45:19.000114Z

@jakemcc i.e. there are three very similar libs that implement certain critical aspects of their purpose slightly differently and it's not obvious what the strengths and weaknesses of each approach are, which makes me hesitant to choose any single one out of fear of locking myself into one that has headaches and bugs

jakemcc 2015-08-19T20:46:59.000115Z

luckily you aren’t really locked into anything since (as far as I know) nothing about any of them requires you to change anything about your code except for adding something to your project.clj

jakemcc 2015-08-19T20:47:31.000116Z

I’m obviously biased in that I think lein-test-refresh is the one people should use, but I’m actually more pro someone using any autorunner