testing

Testing tools, testing philosophy & methodology...
meow 2015-09-03T12:54:53.000013Z

Does anyone mix unit tests in the same file that they are testing? As opposed to creating a separate test file?

meow 2015-09-03T12:56:41.000014Z

I'm wondering if clojure.test and test.check would be useful mixed in?

meow 2015-09-03T12:57:37.000015Z

Prior to clojure I worked a lot in Python and always put my unit tests in separate files, but I'm open to change.

meow 2015-09-03T13:00:53.000016Z

Or maybe I want to get in the habit of writing a few tests in the same file as I'm doing the development, because its easy, and then later moving those tests out into their own file so they don't clutter up the main module.

meow 2015-09-03T13:01:25.000017Z

So my question is as much about workflow as it is about where the tests should ultimately end up.

meow 2015-09-03T13:02:31.000018Z

I'm fairly new to clojure and so far I haven't written very many tests and I'm thinking that now is the time to start making the writing of tests part of my process.

meow 2015-09-03T13:03:30.000019Z

Devcards, among its many other features, makes a good test runner.

ricardo 2015-09-03T13:17:58.000020Z

pkobrien: I don’t - keep them completely separate.

ricardo 2015-09-03T13:19:02.000021Z

Not really sure why I’d want to mix them up. I aim to have the smallest file delta possible. If you mix tests and functionality on the same file, you’d end up having to wade through file diffs where only the test changed.

meow 2015-09-03T13:22:09.000022Z

@ricardo: Right, that's my usual approach with tests.

meow 2015-09-03T13:23:11.000023Z

But some code I was working on recently got me thinking that it might not be bad to through a few tests right into the mix. Partly as tests, but partly as sort of documentation/example/literate programming

meow 2015-09-03T13:23:48.000024Z

This is not a new idea by any stretch of the imagination, its just something I've always rejected in the past.

nberger 2015-09-03T18:08:25.000026Z

@sdegutis: it depends on the kind of system... But I usually like to start the full system (probably a component/system-map, the same that will be use in production but with config for testing) in every test, and stress it from different angles as a whole... I want to have some of those tests at the very least, apart from tests for specific components or groups of components, so I can be sure the "real system" is being tested...

nberger 2015-09-03T18:08:45.000027Z

But that's too broad, were you thinking on a specific kind of system or tests?