JMeter execute ant test local failed - ant

I'm following JMeter wiki page of CommittingChanges which was updated.
I'm running
ant checkstyle
ant package
ant test
Test Failed with error in differences from Bug52310.csv:
BUILD FAILED
C:\jmeter\jmeter\build.xml:2681: The following error occurred while executing th
is line:
C:\jmeter\jmeter\build.xml:2621: CSV Files are not identical.
C:\jmeter\jmeter\bin\testfiles\Bug52310.csv
ComputeIPAddr,200,OK,TG2 1-1,text,true
HTTP-Request-HC31,200,OK,TG2 1-1,text,true
HTTP-Request-HC4,200,OK,TG2 1-1,text,true
C:\jmeter\jmeter\bin\Bug52310.csv
ComputeIPAddr,200,OK,TG2 1-1,text,true
HTTP-Request-HC31,Non HTTP response code: java.net.SocketException,Non HTTP resp
onse message: Network is unreachable: connect,TG2 1-1,text,false
HTTP-Request-HC4,Non HTTP response code: java.net.SocketException,Non HTTP respo
nse message: Network is unreachable: connect,TG2 1-1,text,false
Total time: 3 minutes 9 seconds
Is it a bug or configuration/network issue? can all JMeter tests be execute in local environment?
EDIT
Also next step is to run different test
ant test-headless or ant test-headed (whichever was not run by the ant test)
Why not execute ant test-both in the first place?
when I execute ant test-headed and even and test-both it worked successfully

Regarding your first issue, it looks like a temporary connectivity issue from your machine or more probably that test computes an IP address for your machine that is not reachable .
This test exists to test ip-spoofing feature by setting the ip source to your machine address.
Run it in gui and see what IP is computed on your machine then try to resolve it.
Regarding ant test-both, yes it would be better, report a bug please.

Related

Jenkins integration with JMeter - build is failed giving **Error: Unable to access jarfile ApacheJMeter.jar errorlevel=1**

Jenkins Cosole output :updated 2
When executing the Jmeter .JMX file using JMeter non GUI mode, it is working fine and I am able to get the .JTL file, but when I am trying to trigger the build using Jenkins it is getting failed giving Error: Unable to access jarfile ApacheJMeter.jar
errorlevel=1 as message from console output .
Please note that I have added Perfomance Plugin in Jenkins and made jmeter.save.saveservice.output_format=xml enabled in JMeter user properties. Please help if I am missing anything to setup the configuration.
Build cmd command
C:\jmeter\bin\jmeter -J jmeter.save.saveservice.output_format=xml -n -t C:\jmeter\bin\edueka.jmx -l C:\jmeter\bin\report3.jtl
code from CMD - JMeter non GUI
JMeter Jar file access from CMD
There is nothing wrong with your command, it should work normally.
Double check that the main JMeter executable .jar exists and the user which executes Jenkins process has correct permissions to access this file:
c:\jmeter\bin\ApacheJMeter.jar
The most common mistake is that users download source bundle of JMeter instead of the binary
Also the correct syntax for passing JMeter Properties via -J command line argument is:
J needs to be capital
remove the space between J and the property name
C:\jmeter\bin\jmeter -Jjmeter.save.saveservice.output_format=xml -n -t C:\jmeter\bin\edueka.jmx -l C:\jmeter\bin\report3.jtl
Also currently there is no need to switch JMeter results format to XML, Jenkins Performance Plugin is capable of processing JMeter results files in .CSV format as well

py.test' is not recognized as an internal or external command, operable program or batch file while executing through command prompt

I need your support in order to resolve the below issue. I highly appreciate it if could help here.
I have checked the related post, there was one similar issue but that is during installation. In my case, I have successfully installed the py.test, and I was using it was working as well. Post Jenkins installation I am facing the issue. I have passed the command line in the shell script and tried to execute the Job through Jenkins it is failed. To cross-check, I have verified in the command prompt it throws " py.test' is not recognized as an internal or external command, operable program or batch file". Can you please let me what all checks need to be done to rectify the issue?
Analysis from my end:
Checked in the system variables, there I can see python has been declared.
Regards,
Shiva
I have a work-around solution for that. If you uninstall jenkins from your PC and install&start jenkins from CMD with java -jar jenkins.war, it will resolve the problem. Now it can find and execute batch commands.

Run RobotFramework tests with Sikuli Library with Jenkins on VM (RDC)

I have automation tests based on RobotFramework with SikuliLibrary, which are for Image Compare. I'm using Jenkins to run on external server (VM) the tests.
If I open the VM - image compare script works. The screenshot is created.
If I close the VM session and run the test, there is problem. Here is the log from keyword "Get Match Score":
INFO Could not find C:\Images\image.png
INFO ${scoreFromImage} = 0.0
Is look like, when the VM session is not active (opened), "Get Match Score" cannot take a snapshot from the browser for comparing.
Is there any idea, how to fix this?
The Code:
Compare Process Diagram Image
[Arguments] ${ImageName} ${ImageScore}
${scoreFromImage} = Get Match Score ${ImagesDirectory}${ImageName}.png
${scoreToString} = Convert To String ${scoreFromImage}
${scoreNumberPrecision} = Get Substring ${scoreToString} 0 6
Run Keyword If ${scoreNumberPrecision} == ${ImageScore} Log Successful ELSE Log Fail
Solved:
The VM must be not closed by "X" button. The correct way:
https://support.microsoft.com/en-us/kb/302801
I have .bat file, which contains tscon.exe %SESSIONNAME% /dest:console, after run - the VM is closed correctly.
Also "Jenkins slave jar" must be running.
Running Sikuli Test on VM is possible but need to keep session open. We cannot run Sikuli script on locked PC. When you close VM , it get locked and Test fail to run. Sikuli needs images for comparing and clicking, if session is locked there are no images so Test fail to run.
So how we overcome this ? :
https://support.smartbear.com/viewarticle/85926/
refer this URL for setting . By applying this you can run sikuli Test with minimized window of VM. (Still you cannot close WM window)

Fitnesse - Remote debug error

I'm trying to enable remote-debugging with fitnesse. Getting below error.
Could not complete testing: java.lang.Exception: FitClient: external
process terminated before a connection could be established.
To start fitnesse in debug-mode, i'm adding below startup command
set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9000
java -jar %DEBUG_OPTS% fitnesse-standalone.jar -p 81
And with this, able to connect to the Fitness process, but enabling Tools->Remote Debug from Fitnesse GUI gives above error. Any pointers?
FitNesse is starting the System under test in a separate process by default. You can execute the test suite with debugging enabled, e.g. "MySuite?suite&debug".
Make sure all required libraries are on your class path (the one you use to start FitNesse "java -cp jar1.jar:classes:fitnesse-standalone.jar fitnesseMain.FitNesseMain -p 81"), since your application will be started inside the FitNesse process.

Unable to get JSCover and PhantomJS to run Jasmine test on Cloudbees

I am currently trying to run JSCover in web server mode to determine the coverage of my Jasmine tests that are executed in the PhantomJS headless browser. I am also using grunt+nodejs to kick off the tests.
The code I use in my gruntfile to start the JSCover server and execute phantomJS is:
// Start JSCover Server
var childProcess = require('child_process'),
var JSCOVER_PORT = "43287";
var JAVA_HOME = process.env.JAVA_HOME;
var jsCoverChildArgs = [
"-jar", "src/js/test/tools/JSCover-all.jar",
"-ws",
"--branch",
"--port="+JSCOVER_PORT,
"--document-root=./",
"--report-dir=target/",
"--no-instrument=src/js/lib/",
"--no-instrument=src/js/test/",
"--no-instrument=src/js/test/lib/"
];
var jsCoverProc = childProcess.spawn(JAVA_HOME + "/bin/java", jsCoverChildArgs);
// Start PhantomJS
var phantomjs = require('phantomjs'),
var binPath = phantomjs.path,
var childArgs = [
'src/js/test/lib/phantomjs_jasminexml_runner.js',
'http://localhost:'+JSCOVER_PORT+'/src/js/test/SpecRunner.html',
'target/surefire-reports'
];
runner = childProcess.execFile(binPath, childArgs);
runner.on('exit', function (code) {
// Tests have finished, so clean up the process
var success = (code === 0) ? true : false;
jsCoverProc.kill(); // kill the JSCover server now that we are done with it
done(success);
});
However, when I run the web server on a Jenkins node in cloudbees and then run phantomjs against it, I get one of the following errors:
Some tests start to run, but then the process fails:
A spec : should be able to have a mock lo-dash ...
Warning: Task "test" failed. Use --force to continue.
Aborted due to warnings.
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE
PhantomJS is unable to access the JSCover server:
Running "test" task
phantomjs> Could not load 'http://127.0.0.1:43287/src/js/test/SpecRunner.html'.
Warning: Task "test" failed. Use --force to continue.
For the second error, I have tried to use different ports and hostnames that I set (e.g. 127.0.0.1 or localhost for hostnames, and 4327, 43287, etc. for ports). The ports are not being dynamically set at build time - I have them hardcoded in my grunt script.
Any thoughts on why the errors above might be occurring or why I am having issues running and accessing the JSCover server on a Cloudbees Jenkins node (but never on my local machine)?
So when you execute JSCover with any process, it takes time to be up. If we expect it to be up earlier that it is, the errors are bound to come.
Quoting from the great article: http://blog.johnryding.com/post/46757192364/javascript-code-coverage-with-phantomjs-jasmine-and
Now that I had a code coverage tool that met all of my requirements,
the last part was to get this code to run as part of our Jenkins build
(which utilizes a grunt script). This was easy to get running, but I
encountered two errors that consistently broke my builds:
Sometimes phantomJS would fail to connect to the JSCover server
Sometimes phantomJS would connect to the server, but then give up executing my tests at a random point during the run.
These were really weird issues that only occurred on my team’s Jenkins nodes and were hard to diagnose - even though they turned out to be simple fixes.
For issue 1, that error was the result of my grunt script not waiting for JSCover to start before I executed phantomJS.
For the second issue, it turns out that my team was using a special jasmine test runner to help with producing XML files after tests completed. The problem with this file was that it had a function that waited for Jasmine to complete its execution, but utilized an extremely short timeout before it gave up running the tests. This was a problem with Jenkins + JSCover because it took a longer time for the tests to load and run now that they had to be loaded from a web server instead of straight from the file system. Fortunately, this fix was as easy as increasing the timeout.
I would say that you need to wait for a while after spawning JSCover - in the past I have done things with webdriver when I have spawned, and then waited for it to be available (ideally you can look for a response and sleep, repeat, until the spawned process is ready).
Ie look for a valid http reponse from 127.0.0.1:43287 before continuing (whatever "valid" means that the server is up).

Resources