Search code examples
jenkinshp-uftmobile-center

how to set from Jenkins pipeline the configuration to Mobile Center?


I have some scripts made for regression testing. I created the pipeline and put the isolated test's has a freestyle job.

In the jobs whit the MicroFocus plugin we can set the configuration, trow the wizzard, so we can select the device, the app and app version, etc, that prevails over the UFT script configuration saved on the script.
At pipeline, we do not have that option, so automatically reads the configuration that are at the script and executed the test.

The point its to enable DEV team to run the scripts whit out the need to me reconfigure the scripts, saved and push to GIT whit the new build's they wanna test.

Basically this is my code:

pipeline{
    agent{
       label 'NODE' // Put node
    }
    options {
        timeout(time: 30, unit: 'MINUTES')
    }
    stages{
        stage('Checkout') { 
            steps {
                checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: '**']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/xxx']]]
            }
        }
        stage('Delete Report TC1'){ 
            steps{
              bat 'del /S /Q "P:\\TA\\Mobile\\ANDROID\\PAGAMENTOS\\001. Recargas Telefonicas\\Report"' 
            }
        }
        stage('MOB-AND-PAGAMENTO-001'){ // Name of the test
            steps {
                uftScenarioLoad archiveTestResultsMode: 'ONLY_ARCHIVE_FAILED_TESTS_REPORT', fsUftRunMode: 'Normal', testPaths:  "${env.WORKSPACE}" + '''\\Mobile\\ANDROID\\PAGAMENTOS\\001. Recargas Telefonicas'''   
            }
        }
     }
}

The workaround for this that I'm trying is to call for the build, not the uftcenario. Something like this:

pipeline{
    agent{
       label 'NODE' 
    } 
    options {
        timeout(time: 30, unit: 'MINUTES') 
    }
    stages{
        stage('Checkout') {
            steps {
                checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: '**']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/xxx']]]
            }
        }
        stage('MOB-DCS-AND-CHEQUES-001'){ // The stage name
            steps {
                build 'MOB-DCS-AND-CHEQUES-001'   
            }
        }
        stage('MOB-DCS-AND-CHEQUES-002'){ // The stage name
            steps {
                build 'MOB-DCS-AND-CHEQUES-002'  
            }
        }
        stage('MOB-DCS-AND-CHEQUES-003'){ // The stage name
            steps {
                build 'MOB-DCS-AND-CHEQUES-003'  
            }
        }

    }
}

Don't know if this is the best way to do this.

Thank you Best Regards


Solution

  • Ok, so you can't or i didn't find a way to set the configuration on the script to prevail from the configuration from the script itself.

    So i remake the code to invoke the build/job instead of invoking the scripts from git. That make the test run whit the build/job configuration.

    The build are set to get the script from git, but allow the DEV team do configure and choose the device, app, version app etc...

    At first the pipeline where stopping when the first build start. And saying that jenkins was waiting for executor available.

    So basically, what i discover is, if you make a pipeline and the script calls for builds/jobs, you gonna need to increase your number of executors in the node.

    Do to this go to Manage Jenkins --> Manage Nodes --> select Configure using dropbox on node --> go here say "# of executors" and increase the number.

    In my pipeline i gonna need 2, one for the pipeline itself other for the build. If you gonna run things in parallel you need to increase according your needs.

    At the end i simplify my code.

    pipeline{
        agent{
            label 'xxx' //Insert node here
        }
        options {
            timeout(time: 30, unit: 'MINUTES') // set timeout if you need
        }
        stages{
            stage('xxx'){ // Give stage name
                steps {
                    build 'xxxx'   // Name of the build/job here
                }
            }
        }
    }
    

    Hope it hepls someone one day. :)