Hi Jason,
This is very cool indeed, thanks for putting the prototype together.
I just submitted a patch that makes firefox pop up only once to run
all the tests (it actually pops up twice, once during selenium.start
() and then once for the test suite but the first time is for a split
second).
http://issues.apache.org/jira/browse/GERONIMO-2374
It uses a JUnit TestDecorator to run setup only once for the whole
suite.
IMO until we move to JDK 5 its not a great idea to move to TestNG,
you will get some benefits for sure but the source has to be parsed
at runtime to get at the meta-data (i.e. the info about the tests).
Krufty IMO.
The patch has a comment about invalid XHTML. I believe the invalid
XHTML part of the console is preventing the XPath find from working.
TTFN,
-bd-
On Sep 1, 2006, at 7:46 PM, Jason Dillon wrote:
I've checked in a new top-level testsuite module and a few new
plugins to support it. This is only the start and I expect it to
change over the next few weeks (er maybe months) as momentum starts
to pick up.
I looked into Cargo, and while I think we should eventually use it
to start/stop the server... asis now its broke. We need to provide
a very simple and consistent way for Cargo to invoke some
operations via JMX, which I hinted to in previous emails. Once
that is done, we can patch Cargo and hopefully get that committed
to support G... but in the mean time I whipped up a simple start &
stop mojo that uses Ant to start and stop the server. Its very,
very crude and we need to fix stuff like logging output etc.
I also played around a little with Selenium to make some tests for
the console. It wants a special server process started, so I
created a selenium plugin which currently only starts that server
in... well an icky way, but should work for the moment. Need to
ask the m2 folks how to do this better.
I created a console-testsuite module, which sets up the G server
and Selenium server in pre-integration-test, and then uses the
maven-invoker-plugin to invoke the basic module to actually run the
tests. Only one test class right now, SimpleLoginTest, which does
just that... logs in, logs in and then out and then another that
logs in and clicks some links.
I've got it all running from one mvn command and so far, on my mac,
it works fine. I'd imagine due to the location of the assembly
that Windows will not be able to run this... we'll need to fix this
later. But those of you lucky enough to have a Linux box or a mac,
you should be able to:
mvn clean && mvn install
cd testsuite
mvn
(the testsuite is not hooked up to the default build)
And you should see Firefox popup a few times as Selenium goes about
clicking on stuff. Right now its only really doing validation of
the console page's titles... but if everything works, then the
invoker should not complain and the build should complete.
A bunch more needs to be done... like creating a common test
support class for selenium tests... and probably switching these
tests to use testng, so that the selenium setup is done once, not
for each test... as it does now... so expect Firefox to start and
stop a few times. We need to have some helpers to pick out the
console contents easily so they can be validated... I read that
selenium supports xpath or something, but I have not actually tried
any of that.
This is just a very, very crude proof of concept... needs to have
reporting features added, capture logs, blah, blah, blah.
Anyways, I committed this so we have a common base to work patches
off of.
One thing to note about the Selenium IDE, is that sometimes it does
not put into a waitForPageToLoad(), like if you record a login to
the console... you need to manually add that wait after the button
is clicked or it will hose the test.
I'm not married to any of this either... I just wanted something
that worked... or kinda worked to show that its not going to be
that hard to make some rich integration tests.
So, comments, suggestions, patches... all welcome.
--jason