Selenium Test Commandline - user-interface

How do i post the results to a URL via the "selenium-server.jar"
java -jar selenium-server.jar -htmlSuite "*firefox" "https://www.myserver.com/rc/" "/selenium/Tests/TestSuite2.html" "http://myserver.com/readSeleniumResults"
chrome://src/content/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=https%3A%2F%2Fwww.myserver.com%2Frc%2F&resultsUrl=http://localhost:4444/selenium-server/postResults&test=http%3A%2F%2Flocalhost%3A4444%2Fselenium-server%2Ftests%2FUI_TestSuite2.html
I would like the &resultsUrl to be "&resultsUrl=http://myserver.com/readSeleniumResults"

There's no way Selenium can be able to report the results of the tests to an online site.
If you think it, you'll soon notice there isn't a standard way for which selenium could take care of such task.
I recommend you wrapping that system call inside a script, that once selenium finished takes care of sending the results html file through FTP or the method you've chosen.

This is what I'm doing.
java -jar selenium-server.jar -htmlsuite *iexplore http://yourwebsite c:\testsuite\BasicTestSuite c:\testsuite\results.html

Related

Setting ScalaTest Selenium maxInstances for browser

We have a maven plugin that runs selenium with scala. The arguments passed are formatted as such:
<argLine>-Dbrowser=chrome -Dwebdriver.chrome.driver=${project.basedir}/browser/drivers/chrome/2.25/mac64/chromedriver</argLine>
I've tried adding
-DmaxInstances=5
, as well as using
-browser="browserName=chrome,maxInstances=5,chromeDriver=theDriver"
however they have returned errors.
Does anyone know the correct command line argument using the -D... format?
An example execution would be:
java -Dwebdriver.chrome.driver=theDriver -jar selenium-standalone-server-3.0.1.jar ${SE_OPTS}
where ${SE_OPTS} are the options that selenium takes. the options depend on which role you are running.
Options for Standalone
Options for Hub
Options for Nodes
(see the #Parameter's)
Since version 3.0, we are using JCommander, so ensure that your -D... options are specified before -jar

Running a command line for groovy from XCode after unit testing

I edited my target scheme to run a script action after testing as below
Target Scheme -> Test (Debug) -> Post Actions
The script hw.sh had a simple command line call:
open /Applications/Safari.app/
It worked fine for the above script. When I changed it to the following
groovy http://frankencover.it/with -s /Users/sasokan/Downloads/MyProject
Nothing happened. How can I call this groovy application using a script.
I am also trying to run frankencover.it and had the same problem you did. I eventually found this answer on SO that lead me to a solution. I added the following before calling frankencover.it and it fixed the issue.
PATH=${PATH}:/usr/local/bin
I will further note that even if you use the full path to groovy in the command frankencover.it will fail internally because it cannot find 'lcov' for the same reason.

Running casperjs tests with slimerjs

I wrote a few tests with casperjs. They run just fine with phantomjs. However, when I tried to use slimerjs with the following command:
casperjs --verbose --engine=slimerjs test create-project-suite.js
A small window appers with the SlimerJs logo and version number but the console seems to hang with the following line:
Test file: create-project-suite.js
Is there anything else I need to do? Here are the version numbers:
Mozilla Firefox 28.0
CasperJS version 1.1.0-beta3
Innophi SlimerJS 0.9.1
3.8.0-37-generic #53~precise1-Ubuntu
Update:
I removed code until I got slimerjs to open the browser and execute tests. It seems that it hangs whenever I require a js file (I'm following the page objects pattern):
var Login = require('./objects/login');
I think require.paths could be helpful. Any ideas on how to get around this?
Using full paths makes slimerjs happy:
var path = fs.absolute(fs.workingDirectory + '/objects/login');
var Login = require(path);
It is plain simpler to move all modules to the same directory where the script is.
I tried your command and it works for me, maybe in your file you use an instruction specific to phantom :
http://docs.slimerjs.org/0.8/differences-with-phantomjs.html
But it should open the window(at least the start() ).
Anyway the command is fine.

How to execute Javascript in Selenium RC

I can execute html script and html suite through RC. Now I would like to execute javascript through Selenium RC. I have few question related to this.
Should I need to set class path for that?
After writing test script in javascript, what is the format of javascript suite. Please provide example.
What will be the comment to execute the suite from command prompt? I think the command I used to execute html suite may not work. The command I used java -jar selenium-server.jar -multiwindow -javaSuite "*iexplore" "http://www.google.co.in/" "C:\Tests_suite.html" "C:\results.html"
The way I've used Javascript with Selenium RC id to use the User extensions.
There's some info. here as well.
Or you can use the getEval method of selenium API to execute Javascript from Selenium RC.
From the command line, remember to add:
-userExtensions : indicates a JavaScript file that will be loaded
into selenium

How do I launch the Selenium IDE from the command line with a specific test case loaded?

I'm on Windows, and I want to launch Firefox and the Selenium IDE with a specified test case loaded and ready to play back.
I've got as far as:
>"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content"
which launches Firefox and the IDE, but I don't know enough about the Selenium IDE or Chrome to get any further. I'd expect something like:
>"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content?test=foo.html"
to be supported, but I can't find the right incantation.
As background, I'm generating test case templates from a Swing application and want to just punt them into Firefox for modification and execution with a single button-press. If there's an easier way to do that than Runtime.getRuntime.exec(theAbove) then I'm all ears.
You are close. Selenium has a built-in page to auto load and execute tests from a test-suite called TestRunner.html. You can invoke it like follows :
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://[BASEURL]&test=file:///[TESTSUITE-PATH]&auto=false"
This will fireup firefox with all tests from the test-suite at the specified path loaded up and waiting to execute in a single button press.
For example
After creating a couple of selenium tests, save the test cases as testcase1.html and testcase2.html in a folder say c:\tests.
Save the test suite as testsuite.html in the same folder. Now you can launch
these suite of tests with the below command line :
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://localhost&test=file:///C:\tests\testsuite.html&auto=false"
You should have the tests loaded up in firefox ready to execute.
If you change the above url to have auto parameter to true, then it will run the tests as well after launch.
&auto=true
EDIT :
Updated baseurl argument to proper case sensitive form: baseUrl
Updated path to TestRunner.html to:
chrome://selenium-ide/content/selenium-core/TestRunner.html
If you want to run a testsuite with firefox from the commandline, you have to start run java, not firefox.
Like this:
C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar c:\seltest\selenium-server-standalone-2.18.0.jar -htmlSuite "*firefox" "http://127.0.0.1" "c:\seltest\mytestsuite.html" "c:\seltest\logs\results-firefox.html" -port 5555
-- Freek Borgerink

Resources