Midje
Midje copied to clipboard
Hierarchy of facts only visible on failures but not when printing facts
With these settings:
(change-defaults
:print-level :print-facts)
And a code structure like this:
(facts "API"
(facts "GET /apps"
(fact "status" true)
(fact "returns a collection" true))
(facts "POST /apps"
(fact "status" true)
(fact "returns new URL with UUID" true)
(facts "GET /apps"
(fact "status" true)
(fact "contains added app" true))))
I get such output:
Checking API
Checking GET /apps
Checking status
Checking returns a collection
Checking POST /apps
Checking status
Checking returns new URL with UUID
Checking GET /apps
Checking status
Checking contains added app
From this output the original hierarchy of facts is not visible anymore.
Due to the way emission plugins are implemented, this also affects them. E.g. the junit plugin outputs:
<testcase classname='my-namespace.test-handler' name='status' time='0.005'/>
With a name as short as that, omitting the complete hierarchy, it becomes very difficult to know what was actually tested.
However, when a fact fails, the hierarchy is printed:
FAIL "API - POST /apps - GET /apps/{appId} - DELETE /apps/{appId} - GET /{appId} - status" at (test_handler.clj:66)
It would be very good if :print-facts
would also print the hierarchy, e.g. using dashes, like the output on failure does.