3
votes

apologies for the somewhat confusing title :-) Basically, I've configured my Selenium tests to run through JUnit when I build the project through maven. If I start my Selenium Server in a command prompt and then run the maven build goal in another cmd prompt then the tests runs as expected.

I figured that this process would be easy to implement in Hudson but it has proven quite problematic. I can start my selenium server as before and then configure the build to kick off via a hudson job. However, hudson doesn't seem to be picking up the selenium server - I get an error message which says the following:

Unable to obtain goal [test:test]

The reason I think that hudson isn't contacting the selenium server is because when I run the junit tests through my own command prompt with my server stopped, I get the same error message.

Its also important to note that I used to use the seleniumHQ plugin for hudson to run my tests using html files - but wish to change to JUnit as its more flexible.

Any help on this is very much appreciated!

Thanks, Gearoid.

3

3 Answers

3
votes

I recommend that you run selenium tests separately from the test:test goal.

You can create two hudson builds for your project, with the second build being triggered by the successful completion of the first build.

Why would you do this?

  • Unit tests complete faster, so your feedback time is mush shorter
  • the second build can run a shell script or ant instead of maven, allowing you easier control of your remote server
  • The selenium tests won't be triggered by mvn test on a developer machine, which could cause conflicts.
  • You can run two hudson nodes in a "farm" configuration, the second instance can run on the same server as selenium. Server affinity can be set up for specific builds.
0
votes

Is there a config file with the server URL that is not being picked up running inside Hudson? Can you print the server URL to make sure it's pointing at the right place?

0
votes

You could use the selenium-maven-plugin to start and stop the selenium server automatically as part of the maven build process.