浏览 2792 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-05-22
Functional test with Selenium-on-Rails
(please excuse me for writing in English, I'm working on client-site, and there's no Chinese input software installed on the desktop) 1. Install plugin Selenium-on-Rails by executing $ script/plugin install http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails/ 2. Generate Selenium test by executing $ script/generate selenium <functional-test-name> This will create directory selenium under test and an empty Selenium test file <functional-test-name>.sel 3. Write your functional test based on the generated Selenium test file or record tests with Selenium IDE. NOTE: In the latter case, be sure to save your tests under test/selenium for Selenium will try to load tests found there. 4. Start your Rails application in test mode $ script/server -e test 5. Open Selenium test page http://localhost:3000/selenium and run tests. 6. To run Selenium test as rake task: NOTE: The procedure below works on Linux. For Microsoft Windows, you need to install gem win32-open3-0.2.5.gem, see step 7 for details. 1) Rename vendor/plugin/selenium-on-rails/config.yml.example to config.yml 2) Modify config.yml by specifying the browser will be used by Selenium. NOTE: For FireFox, differ from the configuration for CruiseControll, you specify the path to firefox (e.g., /usr/bin/firefox) instead of firefox-bin (e.g., /usr/lib/firefox/firefox-bin) 3) Start your Rails application in test mode. 4) Run Selenium as rake task by executing $ rake test:acceptance 7. (For Microsoft Windows 2000, XP) Install gem win32-open3-0.2.x.gem 1) Get and unzip win32-open3-0.2.x.zip 2) Go into the directory win32-open3-0.2.x, you can install manually $ cd ext $ ruby extconf.rb $ nmake $ ruby tc_open3.rb (optional, in the 'test' directory) $ nmake install 3) Or use gem to install $ ruby win32-open3.gemspec $ gem install win32-open3-X.Y.Z.gem NOTE: This requires namke.exe and cl.exe in your $PATH 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |