How to get jmeter results in graph using jfreechart and ant - 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/

Related

Can Jenkins Gatling plugin show the different paths

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.

How to create a Jenkins job config.xml?

When I create a jenkins job via the API, I use a previous job's config.xml, make my modifications and then make the POST call to create the job.
My questions is, is there a way to generate this programmatically? I.e. is there a structure of a config.xml, what XML entities it should have, what values, etc so I can write a small module to generate one and send it to the jenkins API call?
I don't think there's any mandatory XML entities. Submitting an empty structure should result in a job that has default values for all settings.
What you want to do is exactly what's done by the Jenkins Job Builder. It provides a YAML-based framework for creating Job configuration XML files and submitting them to Jenkins. It's a common alternative to the Job DSL plugin. I wouldn't recommend to re-implement such a solution yourself -- handling all the plugin-specific XML configuration parts will be a nightmare.
We create our jobs using Job DSL plugin. You can try the playground http://job-dsl.herokuapp.com/.
At first, it seems that it is hard to learn, but after the first seed job, it is much better.
When we started writing our scripts we were afraid that there will not be suitable API methods for our needs. It turned out that we had one such case, which was solved using the configure block.
Get started guide here.

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

Log build file size using Jenkins and display results

This is a broad question, so any answers are deeply appreciated. I need to continually log the size of several build files (in this case some CSS and JS files), preserve this log and ideally show it as a dashboard in Jenkins.
I know that I can setup a cron job and execute a bash script to grab the files and log their size, but I'm not sure where this file would live and how to display it. Ideally the result would be a dashboard plot or bar graph over time.
Thanks.
P.S. I'm open to other logging suggestions, but Jenkins seems like the appropriate system to do this in.
Update: this isn't perfect but it works. Google Spreadsheets has a simple API for posting data, so this can work as an endpoint for any script you want to write that logs your data.
It's not a Jenkins solution, but gets the job done.
In my search leading up to this, I did come across JMeter, and the Performance Plugin for Jenkins, which were contenders for a possible solution.

What is the best Jenkins dashboard plugin that displays all results?

Can someone point out a plugin that can aggregate all results from all jobs into one uniform Pass/Fail/Skipped dashboard?
I am currently using the dashboard view in jenkins that shows me grids, pie charts and test trends using Junit results.
I am now using Calabash and would like to publish the Cucumber reports to the same dashboard.
If someone can point me out to a dashboard that can consume all formats so I can have a centralized reporting page I would appreciate it.
Dashing would be an ideal choice since it is highly customisable.
Check it out from http://dashing.io
There are plenty 3rd party libs that does integration with jenkins and uses dashing in github as well.
Try integrating influxdb with jenkins.
Why influxdb?
Open source
Its time series database
Existing jenkins plugin
Easier to build query using GUI, no need to learn flux query to
get required data
Existing dashboard templates
Easier to connect to Grafana to
visualize, monitor data and create dashboards
Plugin Path: https://plugins.jenkins.io/influxdb/

Resources