Hello everyone,
A couple of weeks ago, the thought of implementing a more modern
JUnit-like testing library for sh using the shtk foundations
(
http://github.com/jmmv/shtk/) crossed my mind. And I have not been
able to resist prototyping it, particularly because I have been
isolated in planes for a long part of this period thus having a lot of
free time (yay long flights!)
So after this week and a half of intense coding, I have been able to
surpass atf-sh's functionality (_including_ atf-check's!).
The new shtk-based library is:
* fully written in sh (no C++ toolchain),
* has a much cleaner codebase than atf-sh,
* supports assert vs. expect checks (fatal vs. non-fatal, that is),
* is infinitely better tested than atf-sh,
* supports fixtures (aka groups of tests that share a common
setup/teardown process),
* supports unit-testing of sh code (e.g. atf-check's counterpart can
be used to verify sh functions!),
* and implements a simplified process to register test cases.
However, it lacks some minor features provided by atf-sh (like other
check functions) and, more importantly, there is a glaring lack of
documentation (other than the docstrings in the code and the code
samples in them) -- but hey, this is only a very preliminary
prototype.
I don't know yet where this is going. I'm currently planning on trying
to convert shtk's own tests to this library to see how things could
look like, and then we'll see how the results stand against atf-sh.
The point of this email is to let you all know that this prototype
exists and is an invitation for you to take a look. Especially, you
can take a look at unittest.subr's comments at the very top for a
snippet of sample code, and also glance over unittest_inttest.sh for
the integration tests of the library itself.
You can take a look at this new code on the "unittest" branch (which
I'll be *rebasing* frequently while working on it, so don't expect
"git pull" to work on already-fetched branches):
https://github.com/jmmv/shtk/tree/unittest
Thoughts? In particular, what do you think of the API? Also, is a
better testing library for shell something you are interested in?
Thanks!