How to run Selenium tests with CI (Continuous Integration)?
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.
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:
Run Selenese Directly Within the Server Using -htmlSuite
You can run Selenese html files directly within the Selenium Server by passing the html file to the server’s command line. For instance:
java -jar selenium-server.jar -htmlSuite "*firefox" "http://www.google.com" "c:absolutepathtomyHTMLSuite.html" "c:absolutepathtomyresults.html"
This will automatically launch your HTML suite, run all the tests and save a nice HTML report with the results.
Note
When using this option, the server will start the tests and wait for a specified number of seconds for the test to complete; if the test doesn’t complete within that amount of time, the command will exit with a non-zero exit code and no results file will be generated.
This command line is very long so be careful when you type it. Note this requires you to pass in an HTML Selenese suite, not a single test. Also be aware the -htmlSuite option is incompatible with -interactive You cannot run both at the same time.
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调用,那么你很好去,很好,很容易。
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.
链接地址: http://www.djcxy.com/p/50780.html上一篇: 如何整合jenkins与硒?