Is there a better way to code-review JMeter test-plans?

  • TLDR - What is the best way to review JMeter Test-Plans stored in a GitHub repo?

    Currently, the code-review process that my performance-test team uses is somewhat cumbersome and of questionable effectiveness. Our team uses GitHub for version-control, and we follow the branching paradigm for check-ins, where the work done for a given story/bug/task is done in a branch of the main-line repository, then merged back into the mainline using the pull-review feature in git-hub.

    This has left us with two options for reviewing changes to our test-plans: 1) Just review the raw XML in the PR diff-viewer 2) pull the un-merged branch and load each changed test-plan into a local-instance of JMeter without benefit of difference hi-lighting.

    This is less than ideal - giving an effective code-review of raw XML is an issue for everyone regardless of what is being modeled. XML just isn't an easily human-readable format.

    But loading the test-plans into JMeter and looking at them there is also problematic in that the information critical to any code-review, namely the exact things that changed, is lost, forcing each test-plan that changed to be reviewed in it's entirety and relying on the pull-request comments to inform the review about what changed.

    As one would expect, this has led to situations where problems which could have been spotted by a code-reviewer have gone un-detected with the lamentable result of increased coding times, increased code-churn, and invalid results which have to be redone.

    So my question to you, dear reader, is What is the best way to code-review JMeter Test-Plans that are stored in a git-hub repo?

  • Unfortunately JMeter .jmx files are basically XML and in case of large test plans it might be not very easy to view the diff.

    You can consider using i.e.

    • Ruby-JMeter which is a Ruby DSL wrapper for JMeter tests, this way the code review will look like a code-review for "normal" Ruby project
    • or Taurus tool which supports definition of JMeter tests using simple YAML syntax so your test script would look like:

          - url:  # url to hit
            method: GET  # request method (GET, POST, PUT, DELETE)
            label: homepage  # sampler label
            body: 'request-body-string'  # if present, will be used as body 
            body:  # generate query string based on parameters and request type
              param1: value1
              param2: value2
            body-file: path/to/file.txt  # this file contents will be used as post body
            upload-files:  # attach files to form (and enable multipart/form-data)
            - param: summaryReport  # form parameter name
              path: report.pdf  # path to file
              mime-type: application/pdf  # optional, Taurus will attempt to guess it automatically
            headers:  # local headers that override global
              Authentication: Token 1234567890
              Referer: http://taurus.blazemeter/docs
            think-time: 1s  # local think-time, overrides global
            timeout: 1s  # local timeout, overrides global
            content-encoding: utf-8  # content encoding (at JMeter's level), unset by default
            follow-redirects: true  # follow HTTP redirects
            random-source-ip: false  # use one of host IPs to send the request (chosen randomly).
                                     # False by default
            extract-regexp: {}  # explained below
            extract-jsonpath: {}  # explained below
            assert: []  # explained below
            jsr223: []  # explained below

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2