Hi Jeremie,
We have started moving functional tests from xwiki-enterprise to
xwiki-platform so that they are grouped by functional domain. Thus
xwiki-enterprise-test-ui is not the best example. You should take a
look at the platform modules that have functional tests:
to name a few. The packager maven plugin is taking care of importing
(installing) your XAR and (I believe) adding the required jar
dependencies to the WAR. You should follow this practice.
Hope this helps,
Marius
On Wed, Mar 20, 2013 at 1:07 PM, Jeremie BOUSQUET
<jeremie.bousquet(a)gmail.com> wrote:
Hello,
I would like to discuss a little on writing of Selenium2 tests, as
described in test strategy [1], ie use Selenium 2 and apply Page Objects
pattern.
My particular use-case is that I'm on a mission : write some functional
tests for my mail archive application.
I also think these would be the best tests for my app, as it greatly relies
on 2 external interfaces (xwiki for persistence/conf, javamail and mail
accounts on another side). There are some good unit tests to write of
course, but the main logic of the app has more meaning to be tested in
"real life", or close to that.
To do that, I decided to try and plug myself in xwiki test framework, in
order to avoid redeveloping everything (such as deploying / launching an
xwiki instance from the tests).
I added 2 modules in my project:
- xwiki-contrib-mailarchive-test-pageobjects
- xwiki-contrib-mailarchive-test-ui
Both inherit from org.xwiki.enterprise:xwiki-enterprise-test pom, and are
greatly inspired from poms of xwiki-enterprise-test-pageobjects and
xwiki-enterprise-test-ui poms.
It's unfinished and untested, but I believe I'll be able to have xwiki
instance installed, launched, and tests run automatically.
My main question, is how should I do in order to also deploy my app in this
wiki instance prior to run the tests ?
For now I have several possible solutions that come to my mind, but I don't
know what would be the best... :
A-
- grab xwiki-standalone zip version x.y.z, unzip it, launch it
- make EM install my application (call some REST API ? GET some page with
proper parameters ?)
- run the tests
B-
- grab xwiki-standalone zip version x.y.z, unzip it
- "patch" it in some way with my application binaries, (ie, add things
directly under permanent directory / extension / repository ?)
- launch it and run the tests
I personnally prefer A-, but it supposes also that the xwiki instance knows
any of my "dev" maven repositories (either my local repository .m2, or my
local instance of Nexus), so it would mean an additional step would be to
"patch" the standalone wiki xwiki.properties to add my personal repo.
Or maybe I can add such repo programmatically in the wiki instance from
java by looking up and using the right component ?
Maybe this point has already been solved by anyone, so if you have any
samples it would be good enough. I did not search exhaustively, but I don't
remember having seen such use-cases on existing extensions on github.
Also, I think it might be interesting to extract from all this some kind of
maven archetype for functional testing of UI extension ? So contributors
could just call the archetype and get everything properly prepared, and
just have to add page objects and tests for their app ...
WDYT ?
BR,
Jeremie
[1]
http://dev.xwiki.org/xwiki/bin/view/Community/Testing#HSelenium2-basedFrame…
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users