Questions tagged [clojure-testing]
16 questions
5
votes
1 answer
Clojure "is" assertion not working as expected
I am writing test cases for my first Clojure project. Here, I want the test to fail if the value of ":meat" is empty :
(deftest order-sandwich
(let [response {:meat "" :bread "yes" :add-on "lettuce"}]
(is (= (:bread response) "yes"))
(is…

Snehaa Ganesan
- 509
- 3
- 10
5
votes
1 answer
Clojure - tests with components strategy
I am implementing an app using Stuart Sierra component. As he states in the README :
Having a coherent way to set up and tear down all the state associated
with an application enables rapid development cycles without
restarting the JVM. It can…

nha
- 17,623
- 13
- 87
- 133
4
votes
3 answers
How to output successful tests from `lein test`?
Using clojure.test, when running lein test, the default settings only print out the number of assertions, like "Ran 12 tests containing 19 assertions," the details for failed tests, and the namespaces tested. I would like an output of the…

GLee
- 5,003
- 5
- 35
- 39
3
votes
2 answers
How to disable test fixtures when no tests are running in the current namespace?
I have seen many clojure projects that disable integration tests by default by adding this setting to project.clj:
:test-selectors {:default (complement :integration)
:integration :integration}
But, if a namespace contains only…

Philip
- 4,128
- 5
- 31
- 49
2
votes
1 answer
Vim Fireplace with nREPL on docker won't run tests
I have a docker container which runs lein repl :start :host 0.0.0.0 :port 7888 (I also exposed the ports via the -p switch like docker run -p 7888:7888).
Now, when I switch to vim and connect to the REPL, everything seems to work as expected. I can…

Adracus
- 891
- 1
- 7
- 19
2
votes
1 answer
Is there an equivalent of Midje facts form in clojure.test?
(facts ...) form in Midje, let's us group a bunch of (fact ..) forms and also have more (facts ..) form under it.
When writing corresponding test suite in clojure.test, what should be used to replace, (facts ...) ? Is there something else in…

Amogh Talpallikar
- 12,084
- 13
- 79
- 135
2
votes
1 answer
How to setup a fixture for a group of tests in clojure.test
In my tests I use something like:
;; api.utils
(defn wrap-test-server [f]
(start-test-server)
(f)
(stop-test-server))
;; api.some-endpoint
(use-fixtures
:once
utils/wrap-test-server)
However, I have to duplicate the fixture setup code in…

Laurent
- 1,141
- 1
- 12
- 17
1
vote
1 answer
Is it common for people to test their clojure.spec specs?
I'm learning Clojure, all by myself and I've been working on a simple toy project to create a Kakebo (japanese budgeting tool) for me to learn. First I will work on a CLI, then an API.
Since I'm just begining, I've been able to "grok" specs, which…

George Silva
- 3,454
- 10
- 39
- 64
1
vote
1 answer
Debugging Clojure expectations
Currently, I have Intellij + Cursive setup for Clojure development. I have my tests written using expectations library
https://github.com/clojure-expectations/expectations
With this setup, the debug process that I follow is putting logs and then…

Constantine
- 1,356
- 14
- 19
1
vote
1 answer
How to generative test function-under-test with must-to-test distinct edge cases for each execution?
Hello Clojure experts..!,
Update: 08/03/2018 1:25PM CDT - Rephrased the question to make it more descriptive.
Update: 08/03/2018 4:10PM CDT - Added negative scenario test to make more sense.
I have a function/spec-under-test (jvm-languages), i want…

Dhanapathi Javvadi
- 13
- 5
1
vote
1 answer
Threading arrow private defns in clojure.test
Consider the following functions in an MVE (minimal viable example) namespace from a fresh lein new app arrow-mve. The function extract-one is public, and the function extract-two is private. I've included the main- function just for completeness…

Reb.Cabin
- 5,426
- 3
- 35
- 64
0
votes
1 answer
ClassNotFoundException when the class is generated by gen-class macro in clojure
I've namespace myorg.helpers.fs-input-stream -Its definition is
(ns myorg.helpers.fs-input-stream)
(gen-class
:name "myorg.helpers.FsInputStream"
:extends java.io.ByteArrayInputStream
:implements [org.apache.hadoop.fs.Seekable…

user51
- 8,843
- 21
- 79
- 158
0
votes
1 answer
Howto include cljs.spec'd functions in a test suite (Redux)
I'm trying to wire into the cljs.test reporting system with a custom macro. I'm following the pattern in…

Nutritioustim
- 2,686
- 4
- 32
- 57
0
votes
1 answer
Testing a simple function call with clojure.test
I'm just starting to play with Clojure and am having difficulty with something basic. I want to just test a simple function that does 1 + 1.
Here's core.clj
(ns core)
(defn run []
(+ 1 1))
Here's the test, core-test.clj
(ns core-test
(:require…

Doug Knesek
- 6,527
- 3
- 21
- 26
0
votes
2 answers
Assertion error in Clojure's deftest macro if comparing lists
My question ist about Clojures deftest macro or more generally about how to compare lists created by functions. But i´m new to Clojure and can´t recognize the specific cause. Maybe anyone else have an idea?
First the reported message:
FAIL in…

Daniel
- 5
- 3