Read the Jenkinsfile: which command runs?
QuizMediumAsked in: Accenture, Capgemini, Infosys, TCS, Wipro
Read the Jenkinsfile.
Jenkinsfile
pipeline {
agent { label 'linux' }
parameters {
choice(name: 'BROWSER', choices: ['chrome', 'firefox'], description: 'Browser for the UI tests')
}
triggers {
cron('H 2 * * 1-5')
}
options {
timeout(time: 60, unit: 'MINUTES')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Test') {
steps {
sh "mvn -B test -Dbrowser=${params.BROWSER}"
}
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
failure {
mail to: 'qa-team@example.com',
subject: "Tests failed: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: "See ${env.BUILD_URL}"
}
}
}
Someone clicks "Build with Parameters" and picks firefox. Which command runs in the Test stage?
- mvn -B test -Dbrowser=firefox
- mvn -B test -Dbrowser=${params.BROWSER}
- mvn -B test -Dbrowser=chrome
- mvn test -Dtest=firefox
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.