Hi devs,
In the past few days I’ve written the first version of a test framework to allow unit
testing wiki pages in our build (see
http://jira.xwiki.org/browse/XWIKI-12643).
The advantages are:
* No running XWiki required
* Relatively fast to execute (<2s) and much faster than functional tests
Some remarks:
* It’s not meant to replace functional tests
* What pushed me to work on this was that I wanted to provide a test for XWIKI-11524 (Do
not display hidden documents in feeds) which I fixed a week ago or so but at the time I
couldn’t do that easily. I would have had to write a functional tests and 1) there was no
test at all existing and setting up the scaffolding is a bit heavy for this small use case
2) I didn’t want to penalize our build by a minute more or so just to validate that a
“hidden/document” query filter is executed...
Now it’s still an experiment at this stage as I don’t know how easy or hard it’ll be when
writing unit tests for other pages and we’ll need to add more component declarations and
setup for sure. On this topic we will need to start developing ComponentList annotation
packs probably in order to not slow down execution of all wiki page tests.
Let me know what you think and in case nobody likes it we can always remove it and move it
to contrib.
Thanks
-Vincent