通过 Hudson 中的 JUnit 运行 Selenium 测试
对于有点令人困惑的标题表示歉意:-) 基本上,当我通过 Maven 构建项目时,我已将 Selenium 测试配置为通过 JUnit 运行。如果我在命令提示符中启动 Selenium Server,然后在另一个 cmd 提示符中运行 Maven 构建目标,则测试将按预期运行。
我认为这个过程在 Hudson 中很容易实现,但事实证明它存在很大问题。我可以像以前一样启动我的 selenium 服务器,然后配置构建以通过 hudson 作业启动。但是,hudson 似乎没有获取 selenium 服务器 - 我收到一条错误消息,内容如下:
Unable to obtain goal [test:test]
我认为 hudson 没有联系 selenium 服务器的原因是因为当我通过自己的命令运行 junit 测试时提示我的服务器已停止,我收到相同的错误消息。
同样重要的是要注意,我曾经使用 hudson 的 seleniumHQ 插件来使用 html 文件运行我的测试 - 但希望更改为 JUnit,因为它更灵活。
非常感谢对此的任何帮助!
谢谢, 齿轮。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您将 Selenium 测试与 test:test 目标分开运行。
您可以为您的项目创建两个 hudson 构建,第二个构建由第一个构建的成功完成触发。
你为什么要这样做?
mvn test 在开发人员机器上,这可能会导致冲突。
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?
mvn test
on a developer machine, which could cause conflicts.是否有一个带有服务器 URL 的配置文件未在 Hudson 内运行?您可以打印服务器 URL 以确保它指向正确的位置吗?
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-plugin 自动启动和停止 selenium 服务器作为 Maven 构建过程的一部分。
You could use the selenium-maven-plugin to start and stop the selenium server automatically as part of the maven build process.