I use MultiRun plugin to build the backend services and the UI in the same Run. I need to run a java command before all this and i want to include it in the multirun configuration i'm using. The command is like:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8001
Which option in the configurations list should i use to set this?.
Thanks.
Related
I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.
However, when I attempt to execute my tests from the CLI, I receive the following error:
src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified)
Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t #tests src/test
It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file
Can you try the ZIP release and if you open the karate batch file you will see this:
java -cp karate.jar:. com.intuit.karate.Main $*
So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.
It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.
For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath
I am trying to debug a java application using property - System.setProperty("javax.net.debug", "ssl"); in my main class.
I see debug logs in console when I run application using Eclipse during development. However, when I try to run same application using webstart I am not able to see any debug logs in any directory so far.
Is there a specific location where this logs are stored during execution?
I also tried passing debug option to run the jar from command line as java -Djavax.net.debug=ssl -jar xyz.jar but still cannot find logs generated.
Can anyone please help me understand to obtain SSL debug logs for java application?
Thank you.
They aren't stored anywhere. They are printed to System.out or System.err.
In some cases, from command line you can write debug output directly into a file:
java -Djavax.net.debug=all -jar xyz.jar > out.log
May be it's easy question but I can't find any info about that.
I used to run selenium 2.x as that way. I start server:
java -jar selenium-server-standalone-2.53.1.jar -Dwebdriver.chrome.driver=chromedriver -browserSideLog -debug -timeout 60
And then I run my tests. I use Dart so I do
pub run test test/selenium/custom_component_test.dart
But now i'm trying use selenium 3. I have downloaded it and substitute my old terminal call with new jar but seems I can do it. Selenium tells me it doesn't know such parameter "-Dwebdriver.chrome.driver". And in help I can't see parameters to specify parameter.
So, how to run selenium 3 with chrome driver?
your options are out of order. -D... is a java runtime variable. it needs to come before the -jar directive.
Change your command to
java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-2.53.1.jar -browserSideLog -debug -timeout 60
I used to run selenium 2.x as that way.
Yes, we changed the source to use JCommander in 3.0 to parse options passed into the jar. -D directives are now parsed as options you are trying to pass into the jar, just like -debug and -timeout. For your command to be well formed, you really should be using -D... before the -jar directive.
I have a PHP project written in PHPUnit using Selenium.
The project is structured as below:
PHPProjectName
Source Files
(doesn't contain anything)
Selenium Test Files
contains all my selenium test php files - extending the class PHPUnit_Extensions_SeleniumTestCase
Include Path
c:\program files\PHP
c:\program files\PHP\PEAR\PHPUnit
I then run start the Selenium server manually by running java -jar selenium-server-standalone-2.24.1.jar
The php script to execute all my selenium test php files works fine.
But now I want to use Jenkins as a test management tool to build and execute my PHPunit tests in this folder. I guess the steps are:
Install Jenkins
Write a build script for the PHPunit tests
Execute the build script through Jenkins
Are the steps correct? Has anyone done or know how to set this up?
Thanks very much,
I have done this many times with various platforms. Your steps are generally correct and should work, however managing the server is not always so simple. The Selenium RC server gets unstable if left open for too long, so you will have to manage it somehow.
You could set up a second Jenkins job which runs once or twice a day to reset your server. The better option however would be to write a simple test framework which closes any open servers and then launches a new server instance before running the tests. You could also use a cron job to reset the server of course, but if you have Jenkins installed it will be easier to do this via a jenkins job.
The best option of course is to switch to Webdriver, but that could take some work depending on how complex your tests are.
We have a similar setup to what you describe. We have Jenkins run a job to restart the Selenium server periodically:
#!/bin/bash
# startselenium.sh: Start Selenium up and also start headless screen.
Xvfb :99 -ac &
export DISPLAY=:99
java -jar /opt/selenium/selenium-server-standalone-2.19.0.jar &
Sebastian Bergmann maintains a bunch of templates for using Jenkins with PHP here:
http://jenkins-php.org/
Included is the necessary Ant script to run PHPUnit (which is really simple and just calls PHPUnit):
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true"/>
</target>
And the necessary 'phpunit.xml' file:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
strict="true"
verbose="true">
<testsuites>
<testsuite name="ProjectName">
<directory suffix="Test.php">tests/unit/</directory>
<directory suffix="Test.php">tests/integration/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build/coverage" title="BankAccount"
charset="UTF-8" yui="true" highlight="true"
lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<file>src/bootstrap.php</file>
</exclude>
</whitelist>
</filter>
</phpunit>
You have to install the selenium plugin in jenkins, then a selenium server will automatically start on jenkins, which will create a hub. Now on the client you have to start a node which connects to this hub.
Note: The jenkins selenium server is always the same version as the selenium plugin from jenkins. So if the selenium plugins name is
selenium plugin 3.1.0 then it runs on selenium server 3.1.0.
After installing the jenkins selenium plugin, then you can find a new option for selenium grid, click on it and you will get more informations:
Now you have to start a jenkins selenium standalone server like this:
Windows (create a .bat file with the following content and execute it, change relevant parts accordingly):
start java -jar -Dwebdriver.gecko.driver="C:\Webdrivers\GeckoDriver\geckodriver.exe" -Dwebdriver.chrome.driver="C:\Webdrivers\ChromeDriver\chromedriver.exe" selenium-server-standalone-<VERSION>.jar -role node -hub http://<YOUR_JENKINS_MACHINE_IP>:<PORT>/grid/register
In my case, I used:
start java -jar -Dwebdriver.gecko.driver="C:\Webdrivers\GeckoDriver\geckodriver.exe" -Dwebdriver.chrome.driver="C:\Webdrivers\ChromeDriver\chromedriver.exe" selenium-server-standalone-3.1.0.jar -role node -hub http://172.25.201.100:4444/grid/register
Make sure to correct the paths to geckodriver and chromedriver to their actual location.
Now the node should connect to the hub and you can start your tests.
More infos:
https://github.com/SeleniumHQ/selenium/wiki/Grid2
I made then saved a test case with the Firefox extension "Selenium IDE".
Now I want to use command line to run this exported html file.
I try to follow this how-do-i-launch-the-selenium-ide-from-the-command-line-with-a-specific-test-case but it doesn't work.
Please help me.
You will need the Selenium RC which you can get from:
http://seleniumhq.org/download/
And Java 1.5 or higher (Download Java here)
1) Install Java
2) Unpack Selenium RC.
3) Open a cmd.exe window and go to the directory containing the Selenium Server (selenium-remote-control-1.0.1\selenium-server-1.0.1)
4) Run the command below:
java -jar selenium-server.jar -htmlSuite "*firefox" "http://10.8.100.106" "C:\mytestsuite\mytestsuite.html" "C:\mytestsuite\results.html"
This should run your test suite in Firefox and write the results to the html file. Obviously you will need to change the "http://10.8.100.106" argument to your own server (this might just be localhost / 127.0.0.1)
It is possible to run individual test cases using Selenese Runner. You can specify a single test case file or a test suite as the unit to run.
We should execute the SeleniumRC in using following command;
java -jar filename.jar
ex:
java -jar program1.jar
the program1 consist of the followings are:
program1.class file
Resource library file such as SeleniumRC Server.jar and Selenium Java client.jar file
This method is applicable for SeleniumRC execution. We can directly create the program1.jar file from eclipse using
File->Export.
Here is an article that explains you step-by-step process of how to run Selenium RC application in Java.
Create a Java Selenium RC test script and executing the script
I have needed to do this before, and used the following:
An Ant Build (complex)
Creating a test runner class(a part of junit framework)class.
Most commonly we would run into build path errors while trying to run from cmd.
If you want to run it from command prompt you may consider writing your selenium test in python.
Make sure you have python installed if you are on windows. Mac will have python by default.
Running test from CMD is quite easy.
Follow below steps
1- Go to home directory and Set class path
Home Directory > set classpath=Home Directory\bin; and press enter
Home Directory > set classpath=Home Directory\lib*; and press enter
2-Home-directory > java org,testng.TestNG testng.xml testng2.xml testng2.xml and hit enter
I have documented all steps here. Hope it will help. Cheers
1) Running from CMD
java -cp "C:\ProjectX\Mortgage\bin;C:\Selenium_latest\selenium2.49.1\*;C:\Selenium_latest\selenium-2.49.1\libs\*" org.testng.TestNG C:\ProjectX\Mortgage\testng.xml
Run above command in C:\ProjectX\Mortgage
2) Create batch file name runner.bat
SET projectLocation=C:\ProjectX\Mortgage
CD %projectLocation%
SET classpath=%projectLocation%\bin;C:\Selenium_latest\selenium-2.49.1\*;C:\Selenium_latest\selenium-2.49.1\libs\*
java org.testng.TestNG %projectLocation%\testng.xml
PAUSE
3) Run the batch file by double clicking on it.
To be able to run in Chrome browser, you can use *chrome option instead of *firefox like below
java -jar selenium-server.jar -htmlSuite "*chrome" "http://localhost" "C:\testsuite\testsuite.html" "C:\testsuite\results.html"
Other browsers list include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
on session null