testing

Testing tools, testing philosophy & methodology...
gleisonsilva 2018-11-22T00:25:07.026400Z

ok. I'm using Atom+ProtoRepl and I just found the command to run the tests.. 😉 thx

gleisonsilva 2018-11-22T00:45:14.027800Z

😞 I was wrong... using repl the tests are not running... altough it prints as if testing, but no test is ran

gleisonsilva 2018-11-22T00:45:37.028Z

...Testing taoensso.encore

Testing io.aviso.writer

Testing clojure.tools.nrepl.misc

Testing clojure.core

Testing clojure.tools.reader.reader-types

Testing clojure.walk

Testing taoensso.truss.impl

Testing flatland.ordered.set

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

gleisonsilva 2018-11-22T00:48:52.028900Z

@seancorfield do I need to config smthing so that (clojure.test/run-all-tests) invoke expectations tests?

seancorfield 2018-11-22T00:51:34.029700Z

@gleisonsilva None of those namespaces would have tests in them. You need to load (`require`) the namespaces that have the tests in them.

seancorfield 2018-11-22T00:53:47.030700Z

It looks like you've only loaded your source (non-test) namespaces.

gleisonsilva 2018-11-22T00:54:40.031200Z

seens like only the "src" folder has been loaded

gleisonsilva 2018-11-22T00:55:25.032100Z

how can I tell proto-repl to load "test" folder (in deps.edn there is a alias with that)?

seancorfield 2018-11-22T01:12:02.033400Z

I start my REPL manually and connect ProtoREPL to it -- I haven't had much luck with the built-in CLI / deps.edn support in ProtoREPL.

seancorfield 2018-11-22T01:12:42.034200Z

So I have an alias :test which adds just my test dependencies and :extra-paths ["test"]

seancorfield 2018-11-22T01:12:59.034600Z

(and I have :runner as a separate alias for Cognitect's test runner)

seancorfield 2018-11-22T01:13:31.034800Z

See https://github.com/seancorfield/dot-clojure/blob/master/deps.edn for example.

seancorfield 2018-11-22T01:14:56.036100Z

In a terminal, I run clojure -A:proto:nrepl:test in my project and once that starts I connect to it in Atom with ctl-, Y and enter the port if it isn't pre-selected.

gleisonsilva 2018-11-22T01:17:34.037100Z

now I have succeed in load test folder in protorepl

gleisonsilva 2018-11-22T01:18:01.037700Z

but seens like the 'expect' are not been recognized, see:

gleisonsilva 2018-11-22T01:18:14.037800Z

gleisonsilva 2018-11-22T01:18:35.038500Z

it prints Testing... but Ran 0 tests..

gleisonsilva 2018-11-22T01:22:13.039600Z

are (clojure.test/run-tests) able to automatically understand expect calls in my test namespace? Or do I need to set something special?

gleisonsilva 2018-11-22T10:05:27.045600Z

right! I got it. Thx

gleisonsilva 2018-11-22T01:32:02.040100Z

😉 i made it! it is working all through proto-repl now

gleisonsilva 2018-11-22T01:32:08.040200Z

seancorfield 2018-11-22T02:31:37.041500Z

ProtoREPL's hot keys to run tests do not work with the expectations namespace style -- as I mentioned above, you need to use named expectations defexpect from the expectations.clojure.test namespace instead.

seancorfield 2018-11-22T02:32:00.042Z

This is why you're having so much trouble.

seancorfield 2018-11-22T02:32:43.043Z

The original Expectations library did not work properly with clojure.test or any of the "standard" test tooling (that was all built on top of clojure.test).

seancorfield 2018-11-22T02:33:50.043800Z

That's why there's a new expectations.clojure.test namespace, with defexpect to define named expectations (and its own versions of expect etc). See https://clojure-expectations.github.io/clojure-test.html

seancorfield 2018-11-22T02:35:34.045200Z

Since you're using the older format of expectations, I'm surprised you're able to get the tests running at all with Cognitect's test runner (I suspect it's mere coincidence -- and the tests just run at JVM shutdown).