Unit Testing: should I use Base.Test instead of FactCheck?

140 views
Skip to first unread message

Florian Oswald

unread,
Oct 28, 2016, 10:30:28 AM10/28/16
to julia-users
I know there are many testing packages out there. I have been using FactCheck, but have seen it's been relegated to the JuliaArchive. I take that as a sign it's a good moment to use something else.

There is 1 thing I sorely miss from Base.Test coming from FactCheck, and that is the ability to say

@fact false --> true "your test failed: false is not true"

i.e. i can print a custom error message to be shown upon failure only.

I also think the display of test results (indentation of lower level "contexts" (@testsets in Base.Test)) is nicer in FactCheck, but that's not that important.

Thanks for any advice.


Steven G. Johnson

unread,
Oct 29, 2016, 12:48:41 PM10/29/16
to julia-users


On Friday, October 28, 2016 at 10:30:28 AM UTC-4, Florian Oswald wrote:
There is 1 thing I sorely miss from Base.Test coming from FactCheck, and that is the ability to say

@fact false --> true "your test failed: false is not true"

@test false || error("your test failed: false is not true.")

Florian Oswald

unread,
Oct 29, 2016, 1:25:21 PM10/29/16
to julia...@googlegroups.com
D'oh.

Thanks!

Spencer Russell

unread,
Oct 31, 2016, 1:01:52 AM10/31/16
to julia...@googlegroups.com
I generally have pretty granular `@testset`s, which can have messages attached that are printed on failure. That way I still get a description of what failed.

I think the lack of indentation for nested testsets is a regression that hit 0.5 (BaseTestNext on 0.4 indents nested testsets), and there’s currently an issue filed: https://github.com/JuliaLang/julia/issues/18611

so they should get re-prettified soon enough.

-s

Florian Oswald

unread,
Oct 31, 2016, 3:33:02 AM10/31/16
to julia...@googlegroups.com
Awesome. Thanks!
Reply all
Reply to author
Forward
0 new messages