jmeter-gradle-plugin icon indicating copy to clipboard operation
jmeter-gradle-plugin copied to clipboard

Enhancement: Add option to disable timestamp in result filename

Open nigelcharman opened this issue 11 years ago • 14 comments

Hi

Thanks for the plugin.

The Jenkins JMeter plugin expects to find the same filename on each build, and it creates a graph across all builds that have the same filename.

Since the Gradle plugin creates a unique filename each time, we don't see this graph on Jenkins.

Would you add an option to remove the timestamp from the results file name?

For reference, the Maven JMeter plugin has a boolean property testResultsTimestamp that controls this. See https://github.com/Ronnie76er/jmeter-maven-plugin/wiki/Test-Results-File-Format#wiki-1.

cheers Nigel

nigelcharman avatar Dec 14 '13 23:12 nigelcharman

@nigelcharman Jenkins jmeter plugin is deprecated in favor of Jenkins performance plugin. The performance plugin takes report names with wildcards, the reports produced by this plugin can be consumed directly.

I am aware I am answering a really old question - I'm just noting that this issue can now be closed.

foragerr avatar Apr 05 '15 00:04 foragerr

@foragerr I would like to re-open dialog on this issue. I cannot use the "Publish HTML reports" plugin in Jenkins because it is unable to publish (save HTML report files from previous builds) Jmeter reports when the reports have a timestamp on the file name. This has become a problem that is not easy to solve otherwise.

djangofan avatar Jun 30 '15 17:06 djangofan

I suppose there will be other plugins that expect constant filename as well. This is an easy fix - I will put in a change this weekend.

Except, my previous pull requests are still pending. I'm really tempted to do a hard fork. I've seen some other people say this as well.

foragerr avatar Jul 01 '15 15:07 foragerr

I tried adding this jmeter option in jmeter.properties , but the plugin seems to ignore it and adds the timestamp anyways: jmeter.save.saveservice.timestamp_format=none

It would be really great if the plugin actually would honor the configuration of the jmeter.save.saveservice. properties.

djangofan avatar Jul 01 '15 16:07 djangofan

Does this work for you?

if resultFilenameTimestamp is "none" do not use a timestamp in filename    
else if resultFilenameTimestamp is "useSaveServiceFormat" use jmeter.save.saveservice.timestamp_format
else default to testfilename-yyyyMMdd-HHmm.xml

foragerr avatar Jul 06 '15 20:07 foragerr

Sounds like it would work fine for Jenkins and I... On Jul 6, 2015 1:40 PM, "RaGe" [email protected] wrote:

Does this work for you?

if resultFilenameTimestamp is "none" do not use a timestamp in filename

else if resultFilenameTimestamp is "useSaveServiceFormat" use jmeter.save.saveservice.timestamp_format else default to testfilename-yyyyMMdd-HHmm.xml

— Reply to this email directly or view it on GitHub https://github.com/kulya/jmeter-gradle-plugin/issues/27#issuecomment-118992268 .

djangofan avatar Jul 06 '15 20:07 djangofan

Need an opinion: When trying to save results with no timestamp, if a results file already exists, should it be overwritten?

foragerr avatar Jul 08 '15 14:07 foragerr

Yes. When the Jenkins html publisher plug in archives the file on each build, it makes a copy and so overwriting is not a problem imho On Jul 8, 2015 7:40 AM, "RaGe" [email protected] wrote:

Need an opinion: When trying to save results with no timestamp, if a results file already exists, should it be overwritten?

— Reply to this email directly or view it on GitHub https://github.com/kulya/jmeter-gradle-plugin/issues/27#issuecomment-119605813 .

djangofan avatar Jul 08 '15 18:07 djangofan

I agree it should be overwritten. For reference, I just tried the Maven plugin and it overwrites the results file and log.

nigelcharman avatar Jul 08 '15 19:07 nigelcharman

Fix implemented in my fork. I also merged all of the other pending PRs from this repo. I will look into releasing to maven central.

@djangofan Could you try out the changes please? Let me know if you need the plugin binary.

foragerr avatar Jul 09 '15 01:07 foragerr

@foragerr Yes, I will test it as soon as I get a chance to build a .jar from your project. I looked at your changes and they look like they will work. I'll get back to you as soon as I can, probably this week sometime.

djangofan avatar Jul 13 '15 18:07 djangofan

You can now apply the plugin this way:

apply plugin: 'net.foragerr.jmeter'

buildscript {
    repositories {
        maven {
            url 'https://dl.bintray.com/jmeter-gradle-plugin/jmeter'
        }
    }
    dependencies {
        classpath "net.foragerr.jmeter:jmeter-gradle-plugin:0.1.1-2.13"
    }
}

Also don't forget to include some variation of the following in the jmeterrun config

enableReports = false
enableExtendedReports = true

I moved a bunch of things around, some things can be very broken. I'm trying to write some unit tests. Meanwhile please report any issues here: https://github.com/jmeter-gradle-plugin/jmeter-gradle-plugin/issues

foragerr avatar Jul 14 '15 00:07 foragerr

@foragerr Ok, I made an attempt to run and it failed. Here is my repo, updated to use your new plugin: https://github.com/djangofan/launch-jmeter

I created a 'runTestsWithGradle.bat' script. When you run it, it generates a XML output, but it FAILS to generate a HTML report and I am not sure why.

Also, I noticed something I didn't notice before: The 'jmeter.save.saveservice.timestamp_format' property ONLY works with CSV output. If you set the properties for XML output with 'jmeter.save.saveservice.output_format=xml' , then if you have 'jmeter.save.saveservice.timestamp_format=none', then Jmeter pukes (with no error message). Sorry, I didn't notice this before.

Just download the .zip of my repo and run it if you want to try.

djangofan avatar Jul 14 '15 03:07 djangofan

Moving this conversation here: https://github.com/jmeter-gradle-plugin/jmeter-gradle-plugin/issues/4

foragerr avatar Jul 14 '15 12:07 foragerr