expectations 2.0 has been released

343 views
Skip to first unread message

Jay Fields

unread,
Mar 11, 2014, 9:28:37 PM3/11/14
to clo...@googlegroups.com
expectations is a minimilist's unit testing framework

website: http://jayfields.com/expectations/
github: https://github.com/jaycfields/expectations

changelog: https://github.com/jaycfields/expectations/blob/master/CHANGELOG.md

some large changes that will hopefully result in even more concise and
maintainable tests.

feedback always welcome.

Jay

Sean Corfield

unread,
Mar 11, 2014, 11:28:06 PM3/11/14
to clo...@googlegroups.com
Looks great Jay - as you know I'm a big fan of Expectations.

One big issue I see here is that by removing 'given' you've made adoption of 2.0 a bit "all or nothing": to use 2.0, I must update our entire test base to rewrite all 'given' tests using the new syntax.

Is there an intermediate version that has both 'given' _and_ the new syntax so folks can migrate piecemeal?

Sean
signature.asc

Sean Corfield

unread,
Mar 12, 2014, 2:53:09 PM3/12/14
to clo...@googlegroups.com
Since `given` was a relatively simple macro, we added it to worldsingles.util.test and switched all our test namespaces to refer given from there instead, and then upgraded to Expectations 2.0.6. Seems to have gone smoothly.

Love the new DSL features!

Sean
signature.asc

Jay Fields

unread,
Mar 12, 2014, 9:35:34 PM3/12/14
to clo...@googlegroups.com
On Wednesday, March 12, 2014 2:53:09 PM UTC-4, Sean Corfield wrote:
Since `given` was a relatively simple macro, we added it to worldsingles.util.test and switched all our test namespaces to refer given from there instead, and then upgraded to Expectations 2.0.6. Seems to have gone smoothly.

Sorry, just saw this email. 'given is pretty simple, and well contained. Adding it as a util seems like a great solution for your case.

While you're converting, if you run into a test that you want to convert but can't quite figure how, a good first pass might be to wrap the whole thing in from-each, do a comparison on the last line, and (expect true ...). You lose all of expectations' smarter comparisons and better failure messages, but it can be a pragmatic choice while converting - allowing you to revisit when you're not focusing strictly on conversion.

I'm glad you're happy with the changes. We've been running the new version in prod for a few weeks and all seems well for us. That said, let me know if you run into issues and I'll fix them up asap.

Jay

Jochen

unread,
Mar 13, 2014, 5:25:01 AM3/13/14
to clo...@googlegroups.com
Hi Jay...

thanks for all the great new features. 

There is just one strangeness I have, exceptions seem not to work with more->, but did with given. 
E.g.
(expect (more-> false identity
                AssertionError assert)
        false)

fails with reporting

>> failure in ( sample_test.clj:4) : sample-test
>> (expect (more-> false identity AssertionError assert) false)
>>    exp-msg: exception in expected: (more-> false identity AssertionError assert)
>>     threw: class java.lang.AssertionError - Assert failed: x__653__auto__
>>            on (sample_test.clj:4)
>> Ran 1 tests containing 1 assertions in 55 msecs
>> 0 failures, 1 errors.

, but 

(expect AssertionError (assert false))

still works.

Ciao

...Jochen

Gal Dolber

unread,
Mar 13, 2014, 5:45:10 AM3/13/14
to clo...@googlegroups.com
Looks great! thanks for sharing


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jochen

unread,
Mar 13, 2014, 6:38:20 AM3/13/14
to clo...@googlegroups.com
Hi Jay....

unfortunately I found another one, again on AssertionErrors but this time with for-each:
(expect AssertionError (from-each [a [1 2]] (assert (string? a)))) ;; all pass as intended
(expect AssertionError (from-each [a [1 "2"]] (assert (string? a)))) ;; still all pass but should signal 1 error
(expect AssertionError (from-each [a ["1" 2]] (assert (string? a)))) ;; still all pass but should signal 1 error
(expect AssertionError (from-each [a ["1" "2"]] (assert (string? a)))) ;; shows both errors

Ciao

Jay Fields

unread,
Mar 13, 2014, 6:54:47 AM3/13/14
to clo...@googlegroups.com
Thanks for all the examples, I'll look today at getting these fixed up. 
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/exQyg9YUUas/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.

Jay Fields

unread,
Mar 16, 2014, 10:55:54 AM3/16/14
to clo...@googlegroups.com
Jochen (and anyone else affected by this): Sorry, took me a few days,
but I've released 2.0.7, which fixes all the bugs reported above.

Cheers, Jay

Jochen

unread,
Mar 17, 2014, 10:41:19 AM3/17/14
to clo...@googlegroups.com
Hi Jay....

yep, with 2.0.7, everything works just fine now. BTW: I still consider this a very quick response time wich is highly appreciated.
Ported all my (thousands of) tests over with no more issues.

Ciao

...Jochen

 
Reply all
Reply to author
Forward
0 new messages