2

I have a .jmx file and I run it in NON-GUI mode on my local machine.

I'd like to push my project to Github and run it via pipeline from Jenkins.

How can I do that?

  1. Do I need to push the whole JMeter folder to Github in order to have the ability to run my JMeter test from Jenkins?
  2. What do I need to specify in the pipeline script?

Thanks in advance!

  • 2
    You will get better answers on SO--nothing about this is testing-specific even though JMeter is a testing tool. – c32hedge Apr 30 '18 at 17:05
3

You will need 3 things in order to run JMeter test in Jenkins:

  1. JMeter .jmx script itself
  2. Java Runtime
  3. JMeter

If you have JMeter installed on the machine the minimal pipeline would look like:

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                git branch: 'your_branch', credentialsId: 'your_credentials', url: 'your_git_url'

            }
        }
    }
    stage('Run JMeter Test') {
        steps {
            dir('your_project_folder') {
                sh '/path/to/jmeter -n -t test.jmx -l result.jtl'
            }
        }
    }
}

Mind that sh is applicable for Linux/Unix/MacOSX systems, if your Jenkins master or slave is running Windows - change it to bat

See How to Run a JMeter Test with Jenkins 2.0 Pipelines and GitHub article for detailed setup instructions if needed.

Couple more useful links:

  • You might want to use JMeter Maven plugin in order to get automatic dependencies management, the chance that you have Maven installed in Jenkins is much higher than JMeter and Maven can download and configure JMeter automatically
  • You might also want to use Jenkins Performance Plugin which can publish test results and performance trends reports to your build dashboard.
  • thanks for your reply. What should I put on stage('Run JMeter Test') in the pipeline script in the case when my project isn't on local but is on Git? – Konstantin V May 1 '18 at 10:59
  • Stage Checkout will pull your project from Git into Jenkins workspace – Dmitri T May 1 '18 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.