How to execute Jenkins job parallely for Testcafe tests execution - testing

I have created the Jenkins job to execute the TestCafe tests, the job is working fine.
But I want to execute multiple jobs parallelly.
As TestCafe runs tests on the default port, it is not allowing me to execute jobs parallelly.
Can anyone please suggest how to achieve this?  
I tried to execute the jobs parallelly, but its is giving an exception port already in use.
I am not able to change the port in Jenkins job

When starting TestCafe, you can set ports:
https://testcafe.io/documentation/402644/reference/testcafe-api/testcafe/createrunner
https://testcafe.io/documentation/402639/reference/command-line-interface#--ports-port1port2
Use different ports for each parallel task.

Related

AWS AppRunner start command running multiple time

I am trying to run apache server on AWS AppRunner using my source code repository with corretto 11 as runtime using the below start command
https://github.com/myanees284/apprunner-jmeter/blob/main/run_apacheee.sh
I could see the commands in the above sh gets executed and service gets deployed successfully as running. However after the deployment and health check, the commands are executed repeatedly.
Application log is here: https://gist.github.com/myanees284/db233e7e0d71eba4643f56c2e1bf87ec#file-application-logs2022-08-22t06_29_55-322z-2022-08-23t06_29_55-322z-json-L281
I am unable to understand why the code is executed multiple times when the service is already running?
After your start script exists, the container stops as well. That's why App Runner starts a new container after

How to start and pause jmeter test plan run

I have a jmeter test plan that is running in a non gui mode on linux to test a server. I want to pause the jmeter test plan for some time to carry some maintenance on server and want to resume the test plan from where it got paused.
I don't know when to stop the test plan before hand, so i can't use timers to code in jmeter
Is there a pause button on jmeter GUI and NON GUI mode to pause the test plan
Linux solution. If you're running Linux you can use kill command like:
kill -STOP 1234 - pause JMeter
kill - CONT 1234 - resume JMeter
replace 1234 with the associated Java process ID
JMeter solution. You can add Constant Throughput Timer to your test plan and set the desired throughput in "requests per minute" using __P() function. When you need to suspend JMeter - you can set the desired throughput to 0 via Beanshell Server. Check out How to Change JMeter´s Load During Runtime article for comprehensive information if needed.
It is not possible to pause Jmeter execution.Thread groups are configured in such a way that it wind through requests and execute test plans fully. The only way to make changes in server is to stop the test, change what you need to and then execute the test again from the beginning.
Also, the test will not make any sense when you resume it after updates in server. Because mostly when updates are done on servers, apache will be restarted for safer side. That means the requests you sent previously is not anymore in the queue. So, even if there is a pause button in JMETER, the test after resume would be the same as that of a new test.
Best practice to do: Run test completely before server update. Take out the results.
Run test after server update. Take out the results.
Then compare the results.

Nightwatch keeps giving 502 bad gateway

I have a docker setup for nightwatch.js to run selenium tests through selenium grid for an express server application. When I just use a docker-compose up and then run my nightwatch tests manually after the server starts everything appears to start properly. If I run them as part of a containers command (ie. in my app server containers command or in a new container based on it that just runs nightwatch) then I get a 503 bad gateway error. I think there is a race condition in my docker setup that is causing this. Is there a way to guarantee my app server starts properly before running my nightwatch tests?
Prefix your command with wait-for-it.sh script (download it a and put in the image):
command: /wait-for-it.sh theotherservice:PORT -- your-previous-command
wait-for-it.sh will wait to the specified server:port to execute the command that is after --, so you can avoid the race condition.

Selenium tests timeout in Saucelabs but are shown as passed in Jenkins. How to show the job as failed when tests timeout in Saucelabs ?

I run Selenium tests on Saucelabs by creating a job in Jenkins. Some of the tests timeout on Saucelabs due to network issue or auth challenge. The result of the job in Jenkins is shown as successfully passed. How do I get the error to be shown on Jenkins job ? Is there a way to make the job fail when tests timeout ? Thanks in advance for the help.
If there is a string that you can search for in the console log output that indicates when the tests have timed out, you can use the Text Finder plugin to look for that string and fail the build.
If your test loses connection to the grid while its running, then Sauce will timeout (after 90 seconds of inactivity in JSON packeets) and because there is no connection from your tests, there is no way for your tests to know that it happened. Unless you set a timeout on your Junit or TestNG test so that if the long timeout is reached you are certain it must be a failure and then there could be a #AfterTest step that tries to ping the grid status with the standard JSON /status request, which if it fails, you could throw a Assert.fail . I haven't tried this but it seems like it might work.
Also, you might be able to use Saucerest to query test status and possibly get a timeout reply?

Jenkins: Restricting test jobs to run on same slave as the job its testing

I've recently started to change my Jenkins jobs from being restricted to a certain slave to being restricted to a slave group identified by a label. However I have test jobs that I need to run on the same slave as the job that they're testing.
I need a way to tie two jobs together such that they can only be run on the same slave, but the slave is still chosen by Jenkins based on availability, etc.
Anyone know how to do this, or even if it's possible? Thanks in advance!
Couldn't you use
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin
and to pass the node name ${NODE_NAME} (see https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables) to the next build, that should be parametrized on the node label (that can be node name) using
https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin
I need a way to tie two jobs together such that they can only be run on the same slave, but the slave is still chosen by Jenkins based on availability, etc.
I have the same problem, and I found Node Stalker Plugin
Right now the plugin can be found on the following url:
https://wiki.jenkins-ci.org/display/JENKINS/Node+Stalker+Plugin
Jenkins calls this plugin as
Job Node Stalker
on plugin management page. It will be part of Jenkins.