[xwiki-devs] [Proposal] New testing framework to write unit test of wiki pages
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
Looks very promissing. Can we also verify the HTML output? At least to see if some information returned by a mocked script service is actually printed. I will give it a try. Thanks, Marius On Fri, Oct 2, 2015 at 3:17 PM, [email protected] <[email protected]> wrote:
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
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 5 Oct 2015 at 14:00:58, Marius Dumitru Florea ([email protected](mailto:[email protected])) wrote:
Looks very promissing. Can we also verify the HTML output?
Yes definitely. You can decide what to output (plain text, html, etc).
At least to see if some information returned by a mocked script service is actually printed. I will give it a try.
Thanks -Vincent
Thanks, Marius
On Fri, Oct 2, 2015 at 3:17 PM, [email protected] wrote:
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
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Marius Dumitru Florea -
vincent@massol.net