I'm using Eclipse in Windows. I have an application that should be tested on a Linux server. I usually connect to the server via winSCP and putty, but I want to make automated tests.
My questions is: How do I connect to Linux server from Windows to test the application?
In general, the better way is using ci tool like Jenkins. If you want do it by yourself, just act as ci server or plan your test procedure.
Act as ci:
on-development-host:
commit the source code to verion control system
on-linux:
check any changes in the version control system
get latest source code from version control system (git pull or svn update, or any other vcs tool you used)
build app from source code (use build tool: ant or maven)
run test-cases and send test report
Arrange test procedure by yourself:
winscp to linux from your computer
run test-cases and send test report
There is a problem in winscp. It is a gui tool and is difficlut to automate.
Ant sshexec and scp task is better for automating test.
You use plink to run commands on the server non-interactively.
Go and check for JSCH connction , you can run multiple commands and even scripts(after loading them from your system) using it
Related
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
I want to execute shell script on remote windows server through java code without any server setup and installations like SSH. My script file is already there on server. I just want to execute it on server cmd from my machine. Any possible solution?
According to definition of shell script from wiki:
"A shell script is a computer program designed to be run by the Unix shell"
Taking into consideration that you want to run a shell script on a windows server it will simply not work. I would suggest you to use some kind of environment as it is provided by cygwin or any other alternatives.
You can also check the following question.
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
1)I partially connected to remote machine and use WinRm through Java to execute .bat file using xebialabs.overthere jars, which got rejected due to licence issue.
2) I even tried to connect remote machine and run batch file through PSExec (without using WinRm), but due to constraints of installing PSExec to our Master machine, this solution was scrapped.
Please help me if there is any way to get this done.
Thanks in Advance
I have some question when using jenkins.
the scenario:
I have installed a tomcat on machine A,and config all necessary environment including JDK, and they work well.
I wrote a shell script named restart.sh to kill the tomcat process,and restart.
I execute the script and it works well.When I check the tomcat process using ps -ef,and it shows the exact JDK path as I already config.The JDK path is /usr/local/java/JDK7
When I execute the restart.sh script via jenkins,problem comes. I can see the tomcat process using the wrong JDK path,/usr/bin/java,not the path as i config. I use SSH Publishers plugin to run the remote script.see as the image below:
enter image description here
I don't know how this problem happen,please help,Thanks all
This might be the problem of path variables, just to cross verify , find JAVA_HOME on your server 1. By logging onto server manually 2. From Exec command of your ssh section of your jenkins job , most probably you will find the answer.
i'm assuming you're jenkins is configured to use jdk which is defined at its root level.
if this didn't solve , we need to look into this problem from another angle.