Setup & Execution of Jmeter Distributed Test run from Jenkins - jenkins

i'm looking for some assistance in execution of Jmeter distributed test runs using Jenkins hosted on Windows platform.
I need to know how to
Start Jmeter master/slave agents (jmeter-server.bat) from Jenkins machine.
how to stop the above process once the test run completes.

A hint: if you don't "stop the above process once the test run completes" you won't have to "start" them.
If you want to control everything from Jenkins you need to install Jenkins agent process on each machine you intend to use as JMeter slave, see Step by step guide to set up master and agent machines on Windows Jenkins wiki page for more details.
Once done you can create a job which will start JMeter processes using simple "Execute windows batch command" step on the agent machines
With regards to your point 2 - it's sufficient to set server.exitaftertest JMeter property to true on slave machines in any convenient way, i.e. by adding -J command-line argument like:
jmeter-server.bat -Jserver.exitaftertest=true

For any Distributed Load Run via Jmeter, the pre-requisite is to get the Jmeter-server.bat running to support and enable master-slave communications by Jmeter between Load agents. Initially i had a struggle how to get this executed as first step in Jenkins and then followed execution of Jmeter commands for load test using Remote distributed run. Hence instead of running the pre-requisite condition of running Jmeter-server.bat from jenkins i made it as a Windows service (as load agents are windows machines) which is running all time and whenever Load test starts from Jenkins, the Jmeter-server running in background which will allow distributed run to go.

Related

JMeter: Stoptest.sh/Shutdown.sh doesn't work from Jenkins

I am running some performance tests from Jenkins. I do have two Windows machines with JMeter and I can configure from Jenkins which one to use. Everything works as expected here.
My issue: I did create another job for Stop/Shutdown the tests in case something goes wrong and you have a big run time. Whenever I try to summon Stoptest.sh/Shutdown.sh on the Windows machine that run tests, nothing happens.
How can I stop tests remotely? It has anything to do with the listening port? Thank you.
PS: Tests are ran using PSExec from Jenkin's Windows slave so there is no active CMD window on the screen.
Be aware that .sh is extension for Linux shell scripts, they cannot be executed by Windows command-line interpreter (CMD or Powershell) if you're running JMeter on Windows you need to go for shutdown.cmd or stoptest.cmd instead
There is also AutoStop Listener plugin which can be used for conditional stopping of JMeter test basing on various criteria, it can be installed using JMeter Plugins Manager

Jenkins skip some jobs in chain of freestyle jobs

We got a requirement to implement CICD using Jenkins.
Here, Jenkins is running in windows machine and application server running in linux machine and build activity should happen in Linux system. So, We are connecting to linux machine using Jenkins's SSH plugin and executing jobs.
I have created list of freestyle jobs to checkout code from CVS, cleanup activity, Build , stop server, start server, Run Junit, run sonar. all these jobs are chained using 'build other projects' option in post build Action section.
Here, all jobs executes in sequential manner. But, sometimes I need to execute only few jobs like stop and start server.
So, please help me how we can randomly pick jobs which need to be run before triggering build.
Thanks,
Ganesha

Running Coded-UI in TFS 2017 as part of the build

As per the documentation, in order to run Coded-UI as part of the build you need to have your build agent running as interactive Mode (Not as a service) also your Test Agent need to be deployed as Interactive Mode.
Now the problem is when you deploy your test agent your build machine will restart automatically so your Build agent will not restart cause its not a a service.
How can you work around this ?
Two options:
Don't use the build server as a test agent. Depending on the complexity and size of the test suite, you can either run the tests directly on the deployed environment or have a dedicated group of test machines to parallelize the run.
Install the test agent outside of a build process and just use the "run functional tests" task to connect to the already-running agent. The "Install test agent" task is really for scenarios closer to option #1, especially if you're doing things like provisioning test machines in the cloud on-demand.
Since you would like to run Coded UI test, you have to configure the test agent to interact with the Desktop and build agent running as interactive Mode.
If you insist on installing the TFS Test agent on the same machine as the Build agent. You need to manually install and configure the agents first. Then specify the test agent installation media path in test agent deploy task and use Run Functional Test task to run Automated Test on agent machine.

Configure Jenkins to Execute tests in UFT

I am running UFT Test Suite manually on the host machine, however i now have the requirement to run the smoke tests as soon as the new build is delivered in jenkins. For that i need to run the test suite automatically using Jenkings. Can someone help me in the direction, how this can be achieved? I have never used Jenkins before.
Looks like theres a plugin for Jenkins which enables integration with HP UFT. Take a look at the Jenkins wiki page for instructions about how to install and use it.
As you didn't mention that you are using ALM so I am assuming that you have some kind of driver script in vbs which runs your test suite. You do not necessarily require any plugin in jenkins to run your UFT suite(however you can also check the suggestion given in the previous answer). Create a job in jenkins and call your vbs file (driver file) or a bat file which kicks off your execution your test machine.
Your test execution machine can be configured as jenkins slave. Only thing which you need to take care off is to remove the settings which can let go your jenkins slave machine which is your uft execution machine in standby mode or locked user mode(uft scripts will fail otherwise). You can handle this by configuring windows settings(if admin allows) or by using some small scripts to move mouse after some intervals.
Your test execution job in jenkins(master) machine can be made dependent on the job which goes to success when new build is available. As soon as new build is available - that job goes to success then your Test job gets notified and connects to UFT execution machine(slave) and starts running your test.
I am trying to integrate ALM with jenkins but not working
Started by user admin
Running as SYSTEM
Building in workspace C:\JENKINSHOME\workspace\CLRP_AUTO_RN
[CLRP_AUTO_RN] $ C:\JENKINSHOME\workspace\CLRP_AUTO_RN\HpToolsLauncher.exe -paramfile props05092020010832244.txt
"Started..."
Timeout is set to: -1
Run mode is set to: RUN_PLANNED_HOST
Unable to retrieve test set folder: Node not found.
Node not found.
Starting test set execution
Test set name: CLRP Smoke Test Automation Run, Test set id: 104
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Could not create scheduler, please verify ALM client installation on run machine by downloading and in installing the add-in form: http://almserver:8080/qcbin/TDConnectivity_index.html
Build step 'Execute Micro Focus functional tests from Micro Focus ALM' changed build result to FAILURE
Finished: FAILURE

How to run jenkins job as a system user?

Rightnow, my jenkins jobs are run by Tomcat Server user.
I wanted it to run as User 'Admin', so i tried creating a slave and
added my same jenkins machine as the slave.
I have also added this as a windows service, and have confiured the
Admin user/pwd in the Logon Tab.
But still, when i run a job which executes the UI tests, i'm not able
to see them running in the firefox but it runs and the screenshots
are captured!
Are you asking how to have Jenkins spawn a process in your session that you can see at the monitor?
Have a look here: Open Excel on Jenkins CI, replace excel with whatever you are launching.
If you use jenkins as windows service, it won't allow GUI execution.
It only allows backgound running jobs.
If you want run UI test then stop your jenkins service , use some other way to connect your slave.

Resources