I am try to follow following references to run the selenium IDE test suites on standalone server . My ultimate purpose is to run headless data-driven tests on ubuntu.
Selenium RC with DataDriven
Running Tests from command line
Selenium Headless tests on Ubuntu
So after looking into these tutorials I have setup very simple test suite and trying to run from command line e.g
java -jar ~/selenium/selenium-server-standalone-2.39.0.jar -userExtensions user-extensions.js -htmlSuite "*firefox" http://google.com ./suite.html ./out/firefox-results.html
Output
org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
10:16:54.164 INFO - Java: Apple Inc. 20.65-b04-462
10:16:54.164 INFO - OS: Mac OS X 10.6.8 x86_64
10:16:54.178 INFO - v2.39.0, with Core v2.39.0. Built from revision ff23eac
10:16:54.250 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
10:16:54.336 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
10:16:54.338 INFO - Version Jetty/5.1.x
10:16:54.339 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
10:16:54.340 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:16:54.340 INFO - Started HttpContext[/,/]
10:16:54.406 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@5ff06dc3
10:16:54.407 INFO - Started HttpContext[/wd,/wd]
10:16:54.413 INFO - Started SocketListener on 0.0.0.0:4444
10:16:54.414 INFO - Started org.openqa.jetty.jetty.Server@4ca31e1b
jar:file:/Users/myname/selenium/selenium-server-standalone-2.39.0.jar!/customProfileDirCUSTFFCHROME
10:16:54.580 INFO - Preparing Firefox profile...
10:16:55.946 INFO - Launching Firefox...
10:16:57.246 INFO - Checking Resource aliases
It does open two firefox windows and hangs there after INFO - Checking Resource aliases
It does not matter If I skip -userExtensions user-extensions.js
,it gives same output , show two popup windows and hangs there. The firefox popup window shows test suite loaded successfully , but not command is executed further.
I wonder if I need to run/configure sth else
Example Test Suite and Test Case:
suite.html
case_a.html
Command
java -jar ~/selenium/selenium-server-standalone-2.39.0.jar -htmlSuite "*firefox" http://www.google.com suite.html firefox-results.html
Tested Under:
A) OS: Mac OS X 10.6.8 x86_64 /java version "1.6.0_65"
B) OS: Windows 7 / java version : 1.7.0_02
Hacks Tried without any luck:
A) Removing xml tag
B) .html file extension
Since this question got much attention and needed a proper solution, which I found this way:
First of all we need proper addons to setup headless tests
Getting the right addons
I am already using following selenium IDE addons
- datadriven v0.2
- flowcontrol v08
- includecommand 1.3
What I need is respective selenium addons which work with selenium core server for which I need
- datadriven_v0.2-core.js
- flowcontrol ( goto_sel08.js)
includecommand ( includeCommand_2.3.js) origional source
since openqa.org does not maintain these addons anymore (probably broken or so) You have to use wayback machine to get js files ( no luck with zip attachments). e g flowcontrol in wayback machine
Since I have done this already and created a gist with some fixes
- datadriven_v0.2-core.js
- flowcontrol ( goto_sel08.js)
- includeCommand_2.3.js
- user-extension.js ( all three of above combined)
Setting up Headless Tests
a) install xvfb ( X Vritual Frame Buffer and firefox )
sudo apt-get update && sudo apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic xvfb x11-apps firefox
b) create xvfb init script /var/init.d/xvfb
if [ -z "$1" ]; then
echo "`basename $0` {start|stop}"
exit
fi
case "$1" in
start)
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 &
;;
stop)
killall Xvfb
;;
esac
c) add to startup script:
sudo update-rc.d xvfb defaults
sudo chmod +x /etc/init.d/xvfb
d) start the xvfb
/etc/init.d/xvfb start
e) Setup selenium Tests (you can put test anywhere)
sudo mkdir /usr/local/SeleniumTests && cd /usr/local/SeleniumTests
checkout/copy your html tests to /usr/local/SeleniumTests
f) create alias to test directory (config file 'selenium_alias')
(only allow from localhost)
<IfModule alias_module>
Alias /SeleniumTests/ /usr/local/SeleniumTests/
</IfModule>
<Directory "/usr/local/SeleniumTests/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
sudo mv SeleniumTests/selenium_alias /etc/apache2/sites-avaiable
sudo a2ensite selenium
sudo service apache2 restart
g) update selenium tests data
(/usr/local/SeleniumTests/tests/data)
e.g change test username/password and baseUrl to test app (which I have in xml file)
h) Download Seleninum Server jar file
sudo mkdir /var/lib/selenium/
sudo wget http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar -o /var/lib/selenium/selenium-server.jar
i) Run the headless /Selenese Tests
export DISPLAY=":99" && java -jar /var/lib/selenium/selenium-server.jar -htmlSuite *firefox https://localhost "/usr/local/SeleniumTests/tests/my_app_smoke_testing_suite.html" "firefox-results.html" -trustAllSSLCertificates -ensureCleanSession -port 5561 -userExtensions /usr/local/SeleniumTests/addons/user-extensions.js
Note I have my selenium addons setup under /usr/local/SeleniumTests/addons
Some of the the steps might not be desirable in all situations.
Try this:
<Selenium server location path>java -jar <selenium-server name>.jar –htmlSuite "*<browser_name>" "<Url of base website>" "<Path of html_suite>" "<Path to store reports>"
selenium-server name :- selenium-server-standalone-2.xx.xx was used.
browser_name :- "iexplore" for Internet Explorer/ "firefox" for
Mozilla Firefox
Url of base website :- Base URL.
Path of html_suite :- The path of test suite you used to save file
(E.g.:"C:\TestSuite.htm", assuming "C" drive as location you used
to save test suite).
Path to store reports :-The path you want to save your test result
into (E.g.:"C:\TestResult.htm", assuming "C" drive as location you
used to save test result).
Some commands are not working in Firefox:
The user extension goto_sel_ide that defines the While and Goto
commands does not work with Selenium RC. Include the user extension
goto_sel08.js instead.
From: https://wiki.mozilla.org/Running_IDE_scripts_with_Selenium_RC
I think you are following these steps from this page:
- Download goto_sel08.js
- Download the 1.3 version of the includeCommand4IDE extension.
- Download the most recent version (0.2) of the datadriven.js extension.
- Merged these files to new user-extensions.js file. This order is critical!
- create an xml file which must contain all the data–input and output–for a single test case.
- Utilize your .xml file
- Use Selenium-IDE or an editor to create an HTML test suite that includes your data-driven test as one of the tests to be executed.
- Execute a command line:
-jar selenium-server.jar
-userExtensions user-extensions.js
-htmlSuite
"*chrome"
"`<base URL>`"
"`<Selenium test suite file>`"
"`<results log file>`"
-timeout nnnn
I don't post all steps. I think these steps are important for create data-driven testing from a Selenium-RC command line. Please check all steps!
Perhaps its working on Ubuntu OS, if its works on Windows. Two popup window is weird for me, but may be not is problem. I can only offer check these points:
- create suite.html with firefox selenium IDE
- try to use *chrome in command line.
- Please check order of scripts in user-extensions.js file.
I hope it helps!