Can we tell Jenkins to execute half of my test in a one slave and other half in another slave machine



  • Is there any way to set up a Jenkins job where it will execute part of the test cases in a Node A and other part of the tests in Node B. Technically, I need to reduce my test executing time executing tests in parallel on two different servers (Agents).

    In the worst case, I was planing to make two jobs which will run two different text.xml files and those XML files will contain different test classes.



  • In a Jenkins pipeline you can run stages parallel:

        pipeline {
        agent none
        stages {
            stage('Run Tests') {
                parallel {
                    stage('Test On agentA') {
                        agent {
                            label "agentA"
                        }
                        steps {
                            sh "run-testsA.sh"
                        }
                        post {
                            always {
                                junit "**/TEST-*.xml"
                            }
                        }
                    }
                    stage('Test On agentB') {
                        agent {
                            label "agentB"
                        }
                        steps {
                            sh "run-testsB.sh"
                        }
                        post {
                            always {
                                junit "**/TEST-*.xml"
                            }
                        }
                    }
                }
            }
        }
    }
    

    https://www.jenkins.io/blog/2017/09/25/declarative-1/


Log in to reply
 

Suggested Topics

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