Run : Apache:j-meter in linuxServer as GUI or any other approach - apache

I have apache j meter installed in my local machine which has .bat file .sh executable files in it, to run in gui mode in windows, now i want to execute it on server which is in linux environment, how can i run as gui mode in server?

Actually you should not be running JMeter in GUI mode, you should use GUI mode for tests development and/or debugging. When it comes to executing the load test itself make sure you run JMeter in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl
In regards to how you can proceed there are several options:
Develop the test under Windows, transfer the .jmx file to Linux box using pscp, WinSCP, FileZilla, etc.
Develop the test under Windows and run JMeter in distributed mode, i.e. have JMeter Master on Windows and JMeter Slave on Linux, see JMeter Distributed Testing Step-by-step guide for more details
You can install X Window Server implementation on Windows box (i.e. Xming or Cygwin/X and use X forwarding so you will run JMeter on linux and see its GUI on Windows.

Related

Accidentally quit while using JMeter

I use jmeter to test api. After it runs sometime, i press stop button then it quit unexpectedly. Who can help me?
os: macOs
jmeter version: 5.3
First of all don't use GUI for test execution, JMeter GUI is only for tests development and debugging, when it comes to running tests you should launch JMeter in command-line non-GUI mode like:
jmeter -n -t /path/to/test.jmx -l /path/to/result.jtl
if you need to terminate the test before it ends naturally - press Ctrl+C or use stoptest.sh or shutdown.sh script
Normally if something goes wrong there should be some information in jmeter.log file
If there is nothing in jmeter.log file check if there are any .hprof files in the folder where you launch JMeter from
Make sure to follow JMeter Best Practices, for example the very first one suggests using the latest version of JMeter which is JMeter 5.4.1 as of now

Running EdgeDriver in Jenkins

I have Selenium tests that I am running through Jenkins on a build server. The tests all run as expected in Chrome (using ChromeDriver) and Firefox (using FirefoxDriver). However, the tests don't run in Edge using EdgeDriver.
When the tests run it gives an error:
Microsoft Web Driver can't be used with the Built-In Administrator account or while User Account Control is turned off.
I have tried turning UAC on, but that no effect. I tried running the Jenkins service as a different user and that also had no effect. I've tried the suggestions from: MicrosoftWebDriver fails when constructing while running under TeamCity agent's windows service
I can run the tests in the same location from a command prompt, just not through Jenkins.
If you configure jenkins slave agent as a windows services, Will get the issues. Because Edge won't run as a headless browsers.
For avoid those issues. we are not suppose to set a slave agent as window services.
Follow the below steps for setup slave agent and then run your script:
***** Then download the agent.jar and place it under jenkins working directory("D:/Jenkins")
***** Open the command prompt as admin user and execute the commands.
java -jar agent.jar -jnlpUrl http://srv-cbe-com4:8080/computer/T/slave-agent.jnlp -secret 07ba92bb8017901287acb979cf30d40a45c17abd2c0edba5b2b3f17cc94915e8 -workDir "D:/Jenkins"

How to get Sikuli working in headless mode

If we have a headless test server running sikuli (both ubuntu and windows configurations needed), how to get it work without a physical monitor and preferably for as many screen resolutions as possible.
I successfully got sikuli running in headless mode (no physical monitor connected)
Ubuntu: check Xvfb.
Windows: install display driver on the machine (to be headless) from virtualbox guest additions display drivers and use TightVNC to remotely set resolution from another machine.
Detailed steps for windows 7
Assume that:
Machine A: to be headless machine, windows 7, with vnc server ready (e.g. TightVNC server installed and waiting for connections).
Machine B: will be used to remotely setup the virtual display driver on machine A.
steps:
Download virtualbox guest additions iso file on Machine A from here (for latest version check latest version here and download VBoxGuestAdditions_x.y.z.iso)
Extract iso file (possibly with winrar) into a directory (let us call it folder D)
using command prompt cd to D folder
Driver extraction
-To extract the 32-bit drivers to "C:\Drivers", do the following:
VBoxWindowsAdditions-x86 /extract /D=C:\Drivers
-For the 64-bit drivers:
VBoxWindowsAdditions-amd64 /extract /D=C:\Drivers
Goto device manager
add hardware
Restart and connect with VNC viewer, now you should be able to change screen resolution
other valuable info on launchpad.
I got SikuliX working in a true headless mode in GCE with a Windows 2016 client system. It takes some duct tape and other Rube Goldberg contraptions to work, but it can be done.
The issue is that, for GCE (and probably AWS and other cloud environment Windows clients), you don't have a virtual video adapter and display, so, unless there's an open RDP connection to the client, it doesn't have a screen, and SikuliX/OpenCV will get a 1024x768 black desktop, and fail.
So, the question is, how to create an RDP connection without having an actual screen anywhere. I did this using Xvfb (X Windows virtual frame buffer). This does require a second VM, though. Xvfb runs on Linux. The other piece of the puzzle is xfreerdp 2.0. The 2.x version is required for compatibility with recent versions of Windows. 1.x is included with some Linux distros; 2.x may need to be built from sources, depending on what flavor Linux you're using. I'm using CentOS, which did require me to build my own.
The commands to establish the headless RDP session, once the pieces are in place, look something like this:
/usr/bin/Xvfb :0 -screen 0 1920x1080x24 &
export DISPLAY=:0.0
/usr/local/bin/xfreerdp /size:1920x1080 /u:[WindowsUser] /p:"[WindowsPassword]" /v:[WindowsTarget]
In our environment we automated this as part of the build job kicked off by Jenkins. For this to work under the Jenkins slave, it was also necessary to run the Jenkins slave as a user process, rather than a service... this can be accomplished by enabling auto admin login and setting the slave launch script as a run (on logon) command.
For those looking to automate on ec2 windows machines, this worked for me: http://www.allianceglobalservices.com/blog/executing-automation-suite-on-disconnectedlocked-machines
In summary, I used RDC to connect, put the following code in a batch file on remote desktop, double clicked it, and sikulix started working remotely (kicking me out of RDC at the same time). Note that ec2 windows machines default to 1024x768 when tscon takes over which may be too small so TightVnc can be used to increase the resolution to 1280x1024 before running.
tscon.exe 0 /dest:console
tscon.exe 1 /dest:console
tscon.exe 2 /dest:console
tscon.exe 3 /dest:console
START /DC:\Sikulix /WAIT /B C:\Sikulix\runsikulix.cmd -d 3 -r C:\test.sikuli -f C:\Sikulix\log.txt -d C:\Sikulix\userlog.txt
I just figure out a way to resolve similar issue.
My env:
local: windows pc
remote (for running sikulix + app I would like to test): windows ec2 instance
My way:
1.create a .bat file, its contents:
ping 127.0.0.1 -n 15 > nul
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)
cd "\path\to\sikulix"
java -jar sikulixide-2.0.5.jar -r /path/to/sikulix -c > logfile.log
prepare your app
run the bat (right click > run as administrator)
ping will give your 10s, so that you can bring your app back to front
you will be disconnnected from rdp connection
Explanation:
ping is like "sleep"
for loop: kick out current user & keep session alive

Jenkins - Windows XP Slave

I'm having big problems connecting a windows slave to a working jenkins CI setup.
How do you connect using command on the master? I've tried the following command:
bash -c 'ssh user#hostname cmd /c "java -jar C:/jenkins/slave.jar -text 2>C:/jenkins/slave_error.txt"'
This successfully connects, BUT all commands talk to whatever shell has been spawned by the ssh server. This should be a new cmd shell (is this akin to a new bash shell?) as if the local user ran cmd.exe. freeSSHd claims to do this, but I can't get it to work. Instead the sshd server shipped with cygwin spawns a cmd shell, which spawns an emulated bash shell, which spawns an emulated cmd shell, which calls "java -jar slave.jar".
It seems that through all those layers of emulation, a) some system environment variables are lost, and b) windows commands run slower. Does anyone else connect to windows with ssh, and if so, how? I haven't found any information on running windows builds remotely with purely command line calls.
The build works perfectly on windows 7 through Java Web Start.
Why does the Java Web Start option, which creates a service on the slave, disconnect after ~20 hours? This option works great, but we cannot tolerate this sort of unreliability. Windows 7 has no such issue.
Why is connection through DCOM seemingly impossible to set up?
In case anyone else is trying to use "Launch slave agents on Unix machines via SSH", it cannot work at all for a windows slave. Use "Launch slave via execution of command on the Master".
Any advice is appreciated.

How to use Selenium Grid to run some commands on the node and system commands locally

I'm trying to solve a problem and I was hoping I could do it with Selenium Grid but I'm not entirely sure that it's possible. Here's my problem...I'm developing test cases using Selenium WebDriver and I need my tests to run on a Windows machine however the AUT runs on a Linux server. I have several tools that only run on Linux and I would like to be able to run some commands/tests on the Windows machine and others in the Linux server. For instance
Test Starts -> Firefox launches (Windows machine)
Login to site (Windows machine)
Run command in Linux server
Return running commands/tests on the Windows box.
Alternatively I could figure out how to run those commands remotely from a Windows machine but I'm not looking forward to doing that.
Out of the box, you cannot use selenium to run commands on your local machine. Selenium/Webdriver is a browser testing tool and can interact only with browser.
Updated Answer based on your comments
Common part to both ways (which I think you already know)
In your java code you should have the code for webdriver/selenium commands that will do step 1 and 2. Your java code should also the contain the logic/code to execute the linux commands as step 3. Step 4 should again be your webdriver command.
This test code should run from the linux server so that the java command execution will happen in the linux box.
Now the only pending part is the execution of test in remote machine.
Method 1 without using grid
Start the selenium server in the windows machine. Point your java tests to the selenium server running in this machine. If your windows machine IP is 10.0.0.1, you should initialize the webdriver object as
WebDriver wd = new RemoteWebDriver(new URL("http://10.0.0.1:4444/wd/hub"),DesiredCapabilities.Firefox());
This will send all your webdriver commands to the selenium server running in 10.0.0.1 on port 4444. Your tests will then get executed in the windows machine. For this to work, your linux server and windows machine should be in same network.
Method 2 using grid.
Its all the same as above, but instead of giving the ip/dns name of windows machine, you should give the ip/dns name of the hub machine. You should also have windows machine registered as an RC to that hub.
I think with AutoIT kind of windows frameworks, we can invoke C:\Windows\System32\cmd.exe to open a command prompt and run some .bat files. If it is Linux /bin/csh or /bin/bash myscript.sh.