如何使用 CI(持续集成)运行 Selenium 测试?
我正在使用 Selenium 来自动测试我的网站。我有大约 100 个测试用例,我想通过自动创建测试套件来每天运行它们。我已经在 Selenium 1 (Selenium RC) 中编写了测试用例,现在迁移到 selenium 2 (WebDriver) 并不容易。有没有什么方法或应用程序可以自动加载和执行 Selenium 1 脚本?
非常感谢您的帮助。
I'm using Selenium for automated testing my websites. I have around 100 test cases and I want to run them every day by making Test Suite automatically. I had written my test cases in Selenium 1 (Selenium RC) and now it is not very easy to migrate to selenium 2 (WebDriver). Is there any way or application out there that can load and execute the Selenium 1 scripts automatically?
Thanks very much for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无需将测试转换为 Selenium 2 即可运行它们。 Selenium 2 包含 Selenium 1 和 Selenium 与 webdriver 合并的所有代码。您现有的脚本应该可以在最新版本的 selenium 上正常运行。
从上面的问题中,我假设您已在 Selenium IDE 中记录了脚本并希望使用 Selenium Server 运行它们,如果是这样,请查看以下内容:
以上摘自 http://seleniumhq.org/docs/05_selenium_rc.html
正如其他人所说,您还可以设置 cron 作业或计划任务来自动运行尽管我建议研究像 Jenkins CI(以前称为 Hudson)这样的 CI 服务器,它可以在设定的时间运行测试,也可以根据代码提交触发运行测试。
You don't need to convert your tests to Selenium 2 to be able to run them. Selenium 2 contains all the code for Selenium 1 and Selenium merged with webdriver. Your existing scripts should run fine with the latest version of selenium.
From the questions above I am assuming that you have recorded your scripts in Selenium IDE and want to run them using Selenium Server, if so have a look at the following:
The above is taken from http://seleniumhq.org/docs/05_selenium_rc.html
As others have said you can also set up cron jobs or scheduled tasks to automate the running of scripts at set times, although I would suggest investigating a CI server like Jenkins CI (formally Hudson) that can either run tests at a set time or be triggered to run tests based on code commits.
开始->节目->配件->系统工具->计划任务
如果您可以让这些脚本被 .exe 调用,那么您就可以开始了,非常简单。
Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
If you can get those scripts to be called by a .exe then you are good to go, nice and easy.
您需要在 Windows 中设置计划任务(假设您提到 C# 后就在 Windows 上)。
因此,在 Selenium RC 上设置自动化任务,它将运行您的测试。
You need to setup a scheduled task in windows (assuming you're on windows since you mention C#).
So setup the automated task on Selenium RC, which will run your tests.