Can Jenkins Gatling plugin show the different paths - jenkins

Is there a way to get the gatling requests in the Gatling Jenkins trend graph? Our build with Jenkins Gatling plugin only shows the trend for the global information in the graph and we want to see the trend per request type as this gives us much more information. Is this possible?
I was looking at the description on their site and it mentions you can configure assertions but to me it wasn't clear if that covers this use case and I'm not finding the assertion files when I run the build with the flag -Dgatling.useOldJenkinsJUnitSupport=true.
To clarify I want the transactions highlighted below in the blue square to appear in the Jenkins graph that shows the trend

Unfortunately isn't possible. However, Gatling has feature for live monitoring where you can setup all needed metrics for each request.
https://gatling.io/docs/current/realtime_monitoring

No, this feature is not available in Gatling OSS Jenkins plugin.
It's available in Gatling FrontLine though.

I got it working using a workaround. The gatling plugin graph will show a trend per simulation. It is looking for /{simulation-name}/global_stats.json in the /build folder.
I wrote a groovy script to parse the json data from stats.json. The structure in stats.json is the same as in global_stats.json. So simply parse the stats.json and copy the json.contents[scenario].stats to a separate file in the build folder:
stats.json structure:
{
...
"contents": {
"scenarioName": {
stats: {...} // copy this part
}
}
scenario-report/global_stats.json
Note the dash "-" in the folder name is required as the plugin is searching for this dash to determine the simulation name. It will nullpointer without it.

Related

Get Sonarqube Analysis Status on a variable (GUI Job)

I couldn't find any solutions to this particular need.
Basically I have a GUI Job and I need the status of the Sonarqube Analysis so I can later send a POST Request with it.
(I'm aware that pipeline exists and works great but because a specific reason I need it to be GUI)
On the pipeline you have the WaitForQualityGate.status(), I've tried using this but no success.
Example of what is desired
Any insights? Thanks in advance
You can use the SonarQube Rest API to get the status.
Whenever you run SonarQube analysis through Jenkins Pipeline, upon the successful analysis you will see report-task.txt created in the workspace folder.
Note: The location of report-task.txt file depends on the tool that was used to generate it. The mvn sonar:sonar task defaults to path target/sonar. In my case, I used sonarscanner to analyse a nodejs project. So the location of report-tast.txt is .scannerwork.
Now, you will get the ceTaskUrl and ceTaskId in report-task.txt. You can use that ceTaskUrl to get the analysisId.
Then, you can use the below api to get the quality gate status using analysisId.
http://<sonarqube_host>/api/qualitygates/project_status?analysisId=$ANALYSIS_ID"
Now, try to get the curl output of the above API into a variable.
If you mean to say that you want a custom variable message to pop up in your Jenkins GUI based on the SonarQube scan status, then that would require you to:
Clone the original Jenkins source code
Add a custom HTML button/div/graphic
Compile the Jenkins code
Build the new code
Execute the generated JAR
Else, you can try some plugins available on Jenkins that would give you the ability to render conditional outputs. No promises on whether they can actually help you change the original GUI.
Any alternative traditional approach wouldn't be able to fulfill your GUI requirement.

how to show quantitative results in Jenkins

Jenkins test results screen shows only pass/failed results.
I would like to show quantitive (number/percentage/time duration etc') results, parsed from logs.
e.g. memory usage, run time of specific methods etc..
What is the best way to do so?
Thanks
good question.
i imagine you're probably looking to extend your Jenkins instance with some plugins that describe more info about the tests you've run. this plugin seems relevant, but requires some experience with JMeter (java-based performance measurment tool) to generate the output that this plugin can then read and display output from a JMeter task that you can run every time your build runs:
https://wiki.jenkins-ci.org/display/JENKINS/Performance+Plugin
the 'readme' in the above plugin details page specifies how to set up a project to run JMeter( see the 'Configuring a project to run jmeter performance test:' near the bottom.
another way to do similar not so immediately tied to a specific jenkins build is to run resource monitors (like Cacti or collectd) on the machines running the tests and analyze those results post-build, but again, outside of the Jenkins context.
HTH.

integration issue with testlink jenkins and Jmeter

I have JMeter setup on Jenkins. I am running some performance test with it. On Jenkins, I have setup the TestLink plugin.
On JMeter, I have 'View Results Tree' tree setup, and export the results to a xml file. With the results with the following format:
<testResults version="1.2">
<httpSample t="81" lt="81" ts="1463588977147" s="true" lb="Unit_EdgeSpanTest_transmission-submit_Case1" rc="200" rm="OK" tn="CinemaCMSAPITest 1-1" dt="text" by="382">
<assertionResult>
<name>Response Assertion-ResponseCode</name>
<failure>false</failure>
<error>false</error>
</assertionResult>
<assertionResult>
<name>Response Assertion-TextResponse</name>
<failure>false</failure>
<error>false</error>
</assertionResult>
</httpSample>
Now I have problem get JMeter results report back to testLink. Googled, not much resource out there tell me what to do. I could only find one resource from Jenkins:https://wiki.jenkins-ci.org/display/JENKINS/Integrating+TestLink++Jenkins++JMeter
But it did not help much. I am not using Ant...
Does anyone has successfully made this work? And could give me some hint of what to do?
Thank you very much in advance!
I recall I had to submit JMeter results to TestLink some time ago. In my case each JMeter sampler represented an individual test case so I used the Beanshell Assertion and TestLink Java API Client combination. If you're not familiar with Beanshell - check out How to Use BeanShell: JMeter's Favorite Built-in Component
If you're not comfortable with coding I guess you can access the API endpoints using HTTP Request or SOAP/XML-RPC Request samplers.
There is also a number of discussions regarding the API on TestLink forum
Hope this helps.
I followed the instruction described in the question to configure the testLink, JMeter, and Jenkins. Just with one problem: I first tried to use the script from the link above, but it seems always returned the wrong result. I wrote a simple java script to transform JMeter XML test result file to TAP format. Except that the link from the question is a good instruction to follow to setup the integration between JMeter/Jenkins/TestLink:
To summarize:
From Jenkins:
install TestLink plugin
Configure TestLink from Jenkins > Configuration
Create a project > Configure:
Invoke TestLink: Put the TestLink Version/Test Project Name/Test Plan Name/Build Name/Custom Fields/Test Plan Custom Fields according to the settings from the TestLink.
Add build action to run the java function/shell script
Result Seeking Strategy: Add the tap directory in 'Include Pattern' Add JMeterTestCase to Key Custom Field.
From TestLink:
Create custom Fields,
Add the JMeterTestCase custom field to test specs. And set the test specs to 'Automated'
Assign the test specs/cases to the according test plan.
From JMeter:
Make sure the test result listener generates xml format result.
Have a script transform JMeter Test result from xml format to Tap format.
In the link from the question, it has a script for doing that, and I also attached a simple script wrote in Java for transforming JMeter Result xml file to TAP file in java:
https://github.com/yueran/jmeterResult_xmlToTap

How do I get a list of jobs with longest build time in Jenkins

I need to generate a weekly report on our Jenkins build cluster. One of the reports is to display a list of jobs that have the longest build time.
The solution I can come up with is to parse the "Build history" page on each slave (also master) and for each build of a job, parse the build page and look for "Took x min x sec on slave-xx".
This feels quite cumbersome, does anyone know a better solution using Jenkins API or Groovy script console?
Thanks
You can get the build data for your report through the Jenkins API. For a given job, you can
retrieve the list of builds with duration information using something like:
http://jenkins:8080/job/my-job/api/json?tree=builds[id,number,duration,timestamp,builtOn]
To see a list of all the API-available build data for a given job:
http://jenkins:8080/job/my-job/api/json?tree=builds[*]
Once you have a query that retrieves the job information that you need for
your report, it should be straightforward to loop over the jobs.
Most Jenkins pages have a link at the bottom to the REST API that describes a bit about accessing the API for that page, e.g. http://jenkins:8080/job/my-job/api.
How about using plugins?
Check this out:
https://wiki.jenkins-ci.org/display/JENKINS/build-metrics-plugin
There are few others too which you can try depending on how much customization/features you want to do/display:
https://wiki.jenkins-ci.org/display/JENKINS/Global+Build+Stats+Plugin - This is quite extensive
https://wiki.jenkins-ci.org/display/JENKINS/Project+Statistics+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/eXtreme+Feedback+Panel+Plugin

How to get jmeter results in graph using jfreechart and ant

I have one JMeter script. I want to run it in ant script(as ant provide result in html page). I also want graph result in that or new Html page. I heard i can do with jfreechart but i don't know how to do it.
Please help me!!!
I'd suggest to pick one of the following options:
Each "Graph" listener has `Write results to file/Read from file" section. You can execute JMeter via Ant task with i.e. Graph Results listener enabled saving output to some file, after that open .jtl or .csv file in Listener and you'll get your graph which you can save to image format and add it to HTML report.However using Graph listeners it isn't very recommended from performance perspective.
If you want some HTML charts it's better idea to consider Google Charts instead of JFreeChart, however some basic XSLT/Javascript knowledge will be required to build graph from XML data.
The fastest and easiest way is using Blazemeter Plugin to JMeter, it's free, can be executed via command line, Ant task, GUI, whatever - it's just another listener which provides professional-looking reports and also has feature of comparing test runs.
Rather than trying to do this yourself, have you considered using the Performance Plugin for Jenkins? It may alreay have the charts you need.
If you still need to develop your own charts, you will need to write a plug-in for JMeter; charts are on page 8.
Why not use JMETER PLUGINS great project which contains all graphs you dream about:
http://jmeter-plugins.org/wiki/ActiveThreadsOverTime/
http://jmeter-plugins.org/wiki/ResponseTimesOverTime/
http://jmeter-plugins.org/wiki/TransactionsPerSecond/
http://jmeter-plugins.org/wiki/HitsPerSecond/
http://jmeter-plugins.org/wiki/CompositeGraph/
http://jmeter-plugins.org/wiki/ResponseCodesPerSecond/
http://jmeter-plugins.org/wiki/LatenciesOverTime/
http://jmeter-plugins.org/wiki/BytesThroughput/

Resources