问题
Currently I am working on selenium IDE, now I need to switch to selenium RC. I have downloaded selenium server.But I really don't know how to proceed further. Even I am not able to start server from command prompt. I have used C:\Selenium RC\selenium-server\jave -jar selenium-server.jar, but it struck in between and not proceeding further.. I am looking for language java or PHP.
Let me know how should I move further for successful execution of scripts by using selenium RC
回答1:
First of all: save a test suite in Selenium IDE (File > Save Test Suite
). You should generate test suite - it will contain information about test cases (which, of course, should also be saved (File > Save Test Case
)).
Then you are ready for testing with Selenium RC.
Try it with below command:java -jar path/to/selenium-server-standalone.jar -htmlsuite "*firefox" "http://google.com" "path/to/your/testsuite1" "path/to/result.html"
result.html
- this file will be generated during/after execution.
Be sure that name of browser, URL and paths to test suite and result file are in the quotation marks.
回答2:
I am using Selenium with PHPUnit. I have got class called, lets say, somethingTest
(test classes must have 'Test' at the end of their names) and extended PHPUnit_Extensions_SeleniumTestCase
. This class contains several test cases as methods (e.g. function testSomeMethod1()
- 'test' at the beginning).
And I run it by command:
phpunit somethingTest.php
As to the second thing:
Unknown command: gotoIf
You should load gotoif extension by adding to the execution command something like:
-userExtensions path/to/extension-file
This indicates a JavaScript file that will be loaded into Selenium.
回答3:
If you choose Java to write code, a better approach would be using an IDE like Eclipse. Once you link the JARs and import them in your Java classes you can write your code quickly and efficiently. On top of that, Ecplise has lot of plugins for testing software like Junit, TestNG's to help you create better test suites. Not to mention a Java IDE is always helpful in debugging test code. Here is a tutorial on how to setup Eclipse with Selenium: http://selftechy.com/2011/05/31/setting-up-selenium-with-eclipse
Hope it helps.
来源:https://stackoverflow.com/questions/9902304/selenium-rc-and-flow-control