properties([
disableConcurrentBuilds(),buildDiscarder(logRotator(numToKeepStr: '25')),parameters([string(defaultValue: "localhost", description: 'Server Login IP address', name: 'LOGIN-IP-VALUE'),choice(choices: ['All','Smoke','Regression'], description: 'Test Suite Name', name: 'Test_Suite_Name'),choice(choices: ['emulator','device'], description: 'Device Type', name: 'DEVICE_TYPE'),extendedChoice(name: 'Slave', value: 'Manish,Evan,Max', defaultValue: 'Manish', description: 'Slave Machine Name', type: 'PT_MULTI_SELECT', visibleItemCount: 2)
])
])
}node("${env.Slave}") {stage('Checkout') {timestamps {checkout scm}
stage('Test') {
timestamps {try {bat 'python.exe -m robot --variable LOGIN-IP-VALUE:%LOGIN-IP-VALUE% --variable DEVICE_TYPE:%DEVICE_TYPE% -d Output -i %Test_Suite_Name% --loglevel TRACE Tests/'} catch (Exception e) {emailSubject = "Jenkins build Failure: ${JOB_NAME} #${BUILD_NUMBER}"emailRecipients = [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']]emailBody = """
table {border:1px solid #ccc}
th {border:1px solid #ccc}
td {border:1px solid #ccc}
</style>
<table>
<tr><th>Result</th><td>${e}</td></tr>
<tr><th>Name</th><td>${currentBuild.fullDisplayName}</td></tr>
<tr><th>Job URL</th><td><a href="${JOB_URL}">${JOB_URL}</a></td></tr>
<tr><th>Build URL</th><td><a href="${BUILD_URL}">${BUILD_URL}</a></td></tr>
</table>
""".stripIndent()
emailext attachLog: true, mimeType: 'text/html', subject: emailSubject, body: emailBody, recipientProviders: emailRecipientsthrow e} finally {
stage('Generate report') {publishHTML([allowMissing: false,alwaysLinkToLastBuild: true,keepAll: true,reportDir:'Output',reportFiles:'report.html',reportName:'Mobile Integration Test Report'])
}
}
}
}