0
0
Selenium Javatesting~20 mins

Report publishing in CI in Selenium Java - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CI Report Publishing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Report Publishing in CI Pipelines

Which statement best describes the purpose of publishing test reports in a Continuous Integration (CI) pipeline?

ATo store test reports only on the local developer machine for privacy.
BTo automatically fix failed tests without developer intervention.
CTo prevent the CI pipeline from running if tests fail.
DTo provide a visual summary of test results accessible after each build to help developers quickly identify failures.
Attempts:
2 left
💡 Hint

Think about why teams want to see test results after every code change.

Predict Output
intermediate
2:00remaining
TestNG Report Publishing Behavior in Jenkins

Given the following Jenkins pipeline snippet that runs TestNG tests and archives reports, what will be the outcome in Jenkins after the build completes?

Selenium Java
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'mvn test'
      }
    }
    stage('Publish Report') {
      steps {
        junit 'target/surefire-reports/*.xml'
      }
    }
  }
}
AJenkins will archive the raw XML files but not display any test summary.
BJenkins will fail the build because the junit step requires HTML reports, not XML.
CJenkins will display a test report summary with passed, failed, and skipped tests after the build.
DJenkins will ignore the junit step and not publish any report.
Attempts:
2 left
💡 Hint

Consider what the junit step does with XML test reports.

assertion
advanced
2:00remaining
Valid Assertion for Selenium Test Report Verification

Which assertion correctly verifies that the Selenium test report contains exactly 5 failed tests using Java and TestNG?

Selenium Java
int failedTests = report.getFailedTestCount();
AAssert.assertEquals(failedTests, 5);
BAssert.assertTrue(failedTests > 5);
CAssert.assertFalse(failedTests == 5);
DAssert.assertNull(failedTests);
Attempts:
2 left
💡 Hint

Think about how to check for exact equality in TestNG assertions.

🔧 Debug
advanced
2:00remaining
Debugging Missing Test Report in CI

A Selenium test suite runs successfully in Jenkins, but the test report is missing from the Jenkins UI. Which is the most likely cause?

AThe test report XML files were not generated or saved to the expected directory.
BThe Selenium tests did not run any assertions.
CThe test code uses deprecated Selenium APIs.
DThe Jenkins server is offline during the build.
Attempts:
2 left
💡 Hint

Think about what Jenkins needs to display reports.

framework
expert
3:00remaining
Configuring Allure Report Publishing in a CI Pipeline

Which Jenkins pipeline snippet correctly runs Selenium tests with Maven and publishes Allure reports assuming Allure plugin is installed?

A
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'mvn clean test'
      }
    }
    stage('Allure Report') {
      steps {
        archiveArtifacts 'target/allure-results/*'
      }
    }
  }
}
B
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'mvn clean test'
      }
    }
    stage('Allure Report') {
      steps {
        allure includeProperties: false, jdk: '', results: [[path: 'target/allure-results']]
      }
    }
  }
}
C
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'mvn clean test'
      }
    }
    stage('Allure Report') {
      steps {
        publishHTML(target: [reportDir: 'target/allure-results', reportFiles: 'index.html', reportName: 'Allure Report'])
      }
    }
  }
}
D
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'mvn clean test'
      }
    }
    stage('Allure Report') {
      steps {
        junit 'target/allure-results/*.xml'
      }
    }
  }
}
Attempts:
2 left
💡 Hint

Recall the Jenkins Allure plugin syntax for publishing reports.