jenkinsparallel-processingsystem-testing

How to configure Jenkins to run my test cases in parallel?


I am building a test system with Jenkins with multiple slave nodes. I have multiple test cases where each of them take at more than 15 minutes to run.

I want to make the system in a way that when I start tests Jenkins running each test case in a node which is free and at the end collects and summarizes the test results.

I have opened a Jenkins job which is general test-case job and it is parametrized where the parameter is the "test name". But I see that Jenkins is executing the jobs sequentially.

How can I configure Jenkins to run builds for the same job (with different parameters) in parallel?


Solution

  • simple syntax for parallel:

    pipeline {
    stages {
        stage('Run Tests In Parallel') {
            parallel {
                stage('Projects Test 1') {
                    agent {
                        node { label "your jenkins label" }
                    }
                    steps{
                       script {
                            your test 1
                       }
                    }
                    post{
                        always {
                            script {
                                echo ' always'                                
                            }
                        }
    
                    }
                }
    
                stage('Projects Test 2') {
                    agent {
                        node { label "your jenkins label" }
                    }
                    steps{
                       script {
                            your test 2
                       }
                    }
                    post{
                        always {
                            script {                                
                                echo ' always'                             
    
                            }
                        }
    
                    }
                }
            }   
        }
    }
    

    }