Setting ScalaTest Selenium maxInstances for browser - maven

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

Related

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.

Change protractor debug port

Is there a way to change protractor's default debugger port 5858? Currently I'm using the following command to launch protractor:
$> protractor debug protractor.conf.js
There's an optional parameter you can pass to pause to use a different port, e.g. browser.pause(5859) :
https://angular.github.io/protractor/#/api?view=Protractor.prototype.pause
The port is hardcoded in several locations of the protractor code:
https://github.com/angular/protractor/search?q=5858&ref=cmdform
So i guess, you could fill an issue explaining your requirement, or you could fork, modify protractor and make a pull request.

Make JRuby inherit Java proxy settings

I would like to make HTTP requests from Rails code running on top of JRuby.
How can I make it to re-use http.proxyHost, http.proxyPort and http.nonProxyHosts settings, given to JVM running it ?
To pass JVM flags through JRuby, use -J.... In this case:
jruby -J-Dhttp.proxyHost=foo -J-Dhttp.proxyPort=1234 -J-Dhttp.nonProxyHosts="*.bar.com" ...
This is explained in JRuby's help text.
-J[java option] pass an option on to the JVM (e.g. -J-Xmx512m)
use --properties to list JRuby properties
run 'java -help' for a list of other Java options
I have had the same issue. I found that java or net::http doesn't obey the nonProxyHosts option. The best way to get around this is to modify the ENV_JAVA settings to account for this.
The steps I took to ensure nonProxyHosts was used were the following:
1) JAVA_OPTS="-Dhttp.proxyHost=192*** -Dhttp.proxyPort=1234 -Dhttp.nonProxyHosts=local|127.0.0.1"
OR
1) JRUBY_OPTS="-J-Dhttp.proxyHost=192*** -J-Dhttp.proxyPort=1234 -J-Dhttp.nonProxyHosts=local|127.0.0.1"
Keep in mind that at least for java1.7 the nonProxyHosts should not have quotations see here.
Now I find that either net::http or java itself doesn't actually honour the nonProxyHosts option.
However you can get around this by doing the following in JRuby
a = URI("http://someurl")
Net::HTTP.new(a).proxy?.should == true
regex = /$#{ENV_JAVA["http.nonProxyHosts"]}/ #dollar needed to behave as expected
if a.hostname.match(regex)
ENV_JAVA["http.proxyHost"]=nil
end
Net::HTTP.new(a).proxy?.should == false
Hope that helps.

How do I pass parameters (e.g. -o CDNW) from Buildr to ScalaTest?

Currently I'm only able to say:
test.using(:scalatest)
Buildr documentation says that class Buildr::Scala::ScalaTest supports the following options:
:properties - Hash of system properties available to the test case.
:environment - Hash of environment variables available to the test case.
:java_args - Arguments passed as is to the JVM.
But those are parameters to test cases and JVM only, not to ScalaTest ?
D:\>buildr --version
C:/Ruby186/lib/ruby/gems/1.8/gems/buildr-1.4.4-x86-mswin32/lib/buildr/java/packaging.rb:62: warning: parenthesize argument(s) for future version
Buildr 1.4.4
See my discussion on Twitter with Alex: http://twitter.com/#!/boia01/status/27605157764145153
If you still need this, please open an issue in Buildr's bug tracker, and we'll address it :)

Selenium Test Commandline

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

Resources