kulya / jmeter-gradle-plugin

Other
40 stars 27 forks source link

Enhancement: Add option to disable timestamp in result filename #27

Open nigelcharman opened 10 years ago

nigelcharman commented 10 years ago

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

foragerr commented 9 years ago

@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.

djangofan commented 9 years ago

@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.

foragerr commented 9 years ago

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.

djangofan commented 9 years ago

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.

foragerr commented 9 years ago

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
djangofan commented 9 years ago

Sounds like it would work fine for Jenkins and I... On Jul 6, 2015 1:40 PM, "RaGe" notifications@github.com 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 .

foragerr commented 9 years ago

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

djangofan commented 9 years ago

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" notifications@github.com 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 .

nigelcharman commented 9 years ago

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

foragerr commented 9 years ago

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.

djangofan commented 9 years ago

@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.

foragerr commented 9 years ago

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

djangofan commented 9 years ago

@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.

foragerr commented 9 years ago

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