To launch browser with Jenkins [duplicate] - java

This question already has answers here:
Jenkins : Selenium GUI tests are not visible on Windows
(9 answers)
Closed 9 years ago.
Configured Jenkins (with Tomcat) on Win7 to launch my maven command. With My maven command i am launching selenium test scripts which launches web broswer and execute the test cases.
Problem: When i trigerrs build using Jenkins, build started and shows everything on Jenkins - Console. it even generates proper html report (which i set in my selenium java code). But everything happens in silent mode (without launching the browser)
Question: where and how to configure Jenkins/Tomcat to launch the browser?

It may be easier to set up a Selenium Grid. This would also allow you to test on different OS and browsers to that set up on your Jenkins box.
It also supports parallel testing if your test framework supports threads.
http://code.google.com/p/selenium/wiki/Grid2

Related

Jmeter linux shell cannot start server

Situation:
I have installed Jasper Reports Library (V6.5.1) on my local Linux server which generates PDF reports (Data is dumped in a temp Oracle DB table for the reporting engine).
It then serves this PDF back to the website from which I kick off the process.
Goal:
Install Jmeter to analyse performance / possible bottlenecks of "Jasper Reports Library" (aka Report Generation) on my local linux server (I cannot access this server via GUI, only shell).
I understand I have to connect my local Windows 10 machine (running same Jmeter 4.0) with this local server. On the server I have to start Jmeter 4.0 Server (via jmeter-server command) however I get an error and am stuck (have not found anything online or even people with the same goal unfortunately...)
Steps I have taken:
Download latest (4.0) bin from here
Extracted on local linux server in /opt/dlins/apache-jmeter-4.0bin
Trying to start server with /usr/lib/jvm/jdk1.8.0_102/bin/java jmeter-server (the default java version is 6 so through this I can run this app with java 8) - Instructions found here
-> Getting error: "Error: Could not find or load main class jmeter-server"
Any help regarding above or even any other tool you may use are appreciated (Maybe there is a preferable way to test performance for the above scenario)
There are 2 aspects related to your issue and screenshot:
1) Using java 8 instead of 6 - This can be done in several ways, depending on your needs and restrictions, such as the need to have Java 6 globally available for other applications and using 8 just to run JMeter, or just replacing 6 with 8 entirely. For the sake of brevity, I'll assume the first scenario, but there's documentation available for both and Dmitri T has partially explained it already.
Anyway, the same JMeter doc link you used, describes (just scroll down a few times) how to create a setenv.sh script in the bin directory and configure JAVA_HOME or JRE_HOME depending on your needs.
To set those variables permanently, you can place them in a file called setenv.sh in the bin directory. This file will be sourced when running JMeter by calling the jmeter script.
You seem to be wanting a JDK, so create the script and add inside JAVA_HOME=/usr/lib/jvm/jdk1.8.0_102, save and exit.
2) Running JMeter - To clarify a minor confusion, java MyCompiledClass instructs java to load and execute the "program" defined in MyCompiledClass, which is not what you want to do, because jmeter-server is a shell script. If you open it, you'll see that it calls the jmeter shell script which will do some configuration, end eventually call (in short) java -jar ApacheJMeter.jar with some arguments and options.
So, to run JMeter make sure your scripts are executable with chmod, and simply run from command line ./jmeter-server. From the same link:
Un*x script files; should work on most Linux/Unix systems:
jmeter - run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.
jmeter-server - start JMeter in server mode (calls jmeter script with appropriate parameters)
jmeter.sh - very basic JMeter script (You may need to adapt JVM options like memory settings).
mirror-server.sh - runs the JMeter Mirror Server in non-GUI mode
shutdown.sh - Run the Shutdown client to stop a non-GUI instance gracefully
stoptest.sh - Run the Shutdown client to stop a non-GUI instance abruptly
Amend your PATH environment variable so Java 8 bin would be before Java 6 bin like:
PATH=/usr/lib/jvm/jdk1.8.0_102/bin:$PATH && export PATH
Once done you should be able to just launch the jmeter-server script like
pushd /opt/dlins/apache-jmeter-4.0bin/bin && ./jmeter-server
More information:
Remote Testing
JMeter Distributed Testing Step-by-step
How to Get Started With JMeter: Part 1 - Installation & Test Plans

install selenium via command or website?

I need help with knowing whether the best way to install selenium is via command line on Mac, or via the selenium website. Same for chrome or IE.exe, should that be installed via command line or the actual website?
If you recommend installing via the website how would that work out for running tests via CI (Jenkins) on other machines - we would practically need to install selenium/ or browser.exe on every machine right? Which is why I thought it may make more sense to install all this via command line.
Either way, any opinions would be greatly appreciated.
1) For run by Jenkins, the better way it's to setup a selenium grid follow guide: https://github.com/SeleniumHQ/selenium/wiki/Grid2
with seleniu grid, you not need to setup selenium on each jenkins salve. because
grid will supply browser machine for your test.
2) For run/debug on local, i recommend a way to setup selenium and chrome.exe/IE.exe by webdriver-manager, which is a Nodejs package.
so you need to install NodeJS firstly.
a. install nodejs:https://nodejs.org/en/download/package-manager/#macos
b. execute 'npm install -g webdriver-manager' in terminal
c. execute 'npm config get preifx', it will print out a path in terminal
d. export above path in PATH environment
e. execute 'webdriver-manager version' to check PATH evnrionment work as expect
3) the command to install selenium stuffs like:
webdriver-manager update --verions.standalone=3.4.0 --versions.chrome=2.30 --versions.ie=
or just webdriver-manager update , this will install latest version of selenium server jar and chromedriver.exe for chrome and geckodriver.exe for firefox.
A reminder: latest version may not compatible with your local browser. so I think you need use options: --versions.xxxx=xxxxx to install certain version.
if latest version not caompatible with your local browser, and you want to start a selenium server, you also need to append the versions options like used in update:
webdriver-manager start --versions.chome=xxxxx (if you need run with chrome)
--versions.gecko=xxxx (if run with firefox) --version.ie=xxxx (if run with ie)
all avaiable options you can get by execute webdriver-manager help as below:
webdriver-manager update --ie

Load desktop application on Windows startup [duplicate]

This question already has answers here:
Run Java application at Windows startup
(8 answers)
Closed 6 years ago.
I have Java desktop application, which runs fine. I can double click on exe or run jar file and runs properly.
I want to load this application whenever system starts. How can I achieve this programmatically?
Or is there any tool available to create exe in such a manner, that once we install it creates shortcut in system startup folder.
I want it be system or code driven rather than individually placing exe in startup folder.
You can set up the exe as a windows service with these steps:
open command prompt as administrator
type this:
sc.exe create <service_name> binPath= "<path to your exe> --service" DisplayName= "<somename>" start= "auto"

Deploy JavaFX on Ubuntu server without display

I'm developing a JavaFX application using jdk1.7.0_51 on Mac OS X (10.9.1) in Netbeans. I can run it without a problem and after a clean build I can also launch the jar from the dist/ folder.
Now I want to deploy this on a 64 bit Ubuntu 13.04 server. I've had a lot of issues doing this but have finally set up the server to have the correct JRE, fonts and libraries. Running the jar resulted in errors going way deeper than my code (going to UnsatisfiedLinks to native libraries where MACOS was mentioned) so I figured it would be best to package my app on Ubuntu itself. I ended up installing NetBeans to make a new (native) JavaFX project and uploaded the src/ and lib/ folders from my machine using sftp. Running the code through the reconstructed project in NetBeans works fine, though I get a warning in the console during run:
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
Regardless, the application DOES run. After a clean build, I can similarly run the jar from the dist/ folder. The same warning appears in the terminal but then the application launches.
However, if I ssh to the server without the -X flag and try to run the application, I get the following:
Failed in XOpenDisplay
(java:29341): Gtk-WARNING **: cannot open display:
However, my application does not have a UI. It simply uses JavaFX for the WebEngine (this is required and can not be changed). I was wondering if anyone knows if (and if so, how) it's possible to launch my JavaFX jar without a display (to just run as a daemon on the server).
Kind regards,
Warkst
EDIT:
I've tried some things described here: Java Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable
You need to specify the -Djava.awt.headless=true parameter at startup time.
(Assuming I'm doing it right with the command java -Djava.awt.headless=true -jar MyApp.jar), this yielded no results (the same errors occur).
export DISPLAY=:0
Still no result, though the error obviously changed slightly to now read:
(java:30765): Gtk-WARNING **: cannot open display: :0
Then finally I also tried the following:
unset DISPLAY
This resulted in the original error (where obviously DISPLAY was not set).
I don't think JavaFX 2.x supports running in a headless mode. I don't know of any workaround.
For further info see the JavaFX issue tracker feature request: RT-34241 Use of WebEngine in a headless system, currently scheduled for implementation for Java 9.
I had almost the same problem
Failed in XOpenDisplay
(java:2593): Gtk-WARNING **: cannot open display:
while running unit tests for my JavaFX application in headless Ubuntu docker container on Travis CI.
The solution is installing X Virtual Framebuffer (xvfb) in the container to imitate a display presents via the container configuration change in .travis.yml
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
This allows JavaFX successfully initialize it's core and create JavaFX components without actually showing them on screen.
See details of this solution in article Using xvfb to Run Tests That Require a GUI
Running dbus-update-activation-environment --systemd DISPLAY XAUTHORITY in that shell before launching the UI app fixed this issue for me.

Remote Debugging via SSH | Netbeans [duplicate]

This question already has answers here:
Remotely debug unit tests in Netbeans / Maven
(2 answers)
Closed 6 years ago.
I'm programing on an embedded linux system calls BeagleBone Black. I'm using JDK vers. 1.6 to run my programms.
At the moment i write code on my normal pc (win7), create a .jar and transfer it via FileZilla to the Linux system (arm7). Then i connect with the embedded system using Putty (ssh tunnel) and start my programm ..."java -jar [name].jar"
Now i'm searching for a way to connect Neatbeans directly to the linux system. To bypass this laborious methode. Is there a way to debugg a programm on my pc via netbeans and it will automatically run on linux? (with console output in netbeans)?
How to configurate the ide for such a task?
Or is there alternative option?
Thanks
You can create a shared folder into the Beagle Bone via SSH an use it as a normal folder.
I am not sure about if you can do this on windows, but im sure that linux can!

Categories

Resources