Jenkins pipeline for parallel cross browser testing

I need to find solution/s for next case. There is selenoid in docker which runs browsers in containers, the tests should be run in parallel for some browsers. I made pipeline in Jenkins for that goal. And all tests run in parallel for browsers but they work with the same workspace and I got errors from time to time. How can I make Jenkins settings or pipeline configuration to have each browser branch with its own workspace or thomething else to avoid conflicts.

pipeline {
    agent any
    tools {
        maven 'MAVEN_HOME'
    }
    stages {
        stage('setup parameters') {
            steps {
                script {
                    properties([
                        parameters([
                        choice(
                            choices: ['chrome', 'firefox', 'all'],
                            name: 'browser'
                        )
                    ])
                    ])
                }
            }
        }
        stage('clone code') {
            steps {
                echo 'git'
                git branch: 'feature/selenoid-integration', credentialsId: '......', url: 'https://github.com/.../selenide-web-test-project'
            }
        }
        stage('test') {
            steps {
                script {
                    if (browser.equals("chrome")) {
                        echo 'chrome'
                        bat 'mvn clean -Dbrowser.type=chrome test'
                    }
                    if (browser.equals("firefox")) {
                        echo 'firefox'
                        bat 'mvn clean -Dbrowser.type=firefox test'
                    }
                    if (browser.equals("all")) {
                        echo 'all'
                        parallel(
                        chrome: {
                            bat 'mvn clean -Dbrowser.type=chrome test'
                        },
                        firefox: {
                            bat 'mvn clean -Dbrowser.type=firefox test'
                        }
                        )
                    }
                }
            }
        }
    }
}


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation