Running Selenium Tests through JUnit in Hudson

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.


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.

  • 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?


    您可以使用selenium-maven插件作为Maven构建过程的一部分自动启动和停止硒服务器。

    链接地址: http://www.djcxy.com/p/8948.html

    上一篇: Hudson风格在Eclipse中的开发人员机器上构建报告

    下一篇: 在Hudson中通过JUnit运行Selenium测试