Selenium Testing Framework Selenium CI/CD Integration & Automation Architecture 1 — Questions and Answers
Question 1: Which Maven plugin is commonly used to run Selenium/TestNG tests as part of a CI build?
- maven-compiler-plugin
- maven-surefire-plugin (Correct answer)
- maven-deploy-plugin
- maven-resources-plugin
Correct answer: maven-surefire-plugin
The maven-surefire-plugin executes unit and integration test classes during the `test` lifecycle phase in a Maven build.
Question 2: In a Jenkins pipeline, which stage would you typically run Selenium regression tests?
- Build
- Post-deploy test stage after the application is deployed to a test environment (Correct answer)
- Source checkout
- Artifact archival
Correct answer: Post-deploy test stage after the application is deployed to a test environment
Selenium tests need a running application to interact with, so they are executed after the app is deployed to a test environment.
Question 3: What is the purpose of using headless browser mode (e.g., `--headless` flag) in CI/CD pipelines?
- To speed up JavaScript execution
- To run browser tests on servers without a display or GUI (Correct answer)
- To disable JavaScript in tests
- To reduce network requests
Correct answer: To run browser tests on servers without a display or GUI
Headless mode allows Chrome or Firefox to run without a graphical display, making Selenium tests possible on CI servers with no screen.
Question 4: Which GitHub Actions feature allows you to run Selenium tests against a browser installed on the runner?
- GitHub Packages
- actions/setup-java
- services containers
- Browser installed by default on ubuntu-latest runners (Correct answer)
Correct answer: Browser installed by default on ubuntu-latest runners
GitHub Actions ubuntu-latest runners come with Chrome and Firefox pre-installed, so Selenium tests can run directly without extra setup.
Question 5: What does 'shift-left testing' mean in the context of Selenium and CI/CD?
- Moving test execution to the left side of the IDE screen
- Running tests earlier in the development lifecycle, catching bugs before deployment (Correct answer)
- Reducing the number of test cases
- Running tests from right to left in the pipeline
Correct answer: Running tests earlier in the development lifecycle, catching bugs before deployment
Shift-left testing integrates automated tests earlier in the pipeline so developers get fast feedback before code reaches production.
Question 6: Which reporting library is commonly integrated with Selenium/TestNG to produce rich HTML test reports in CI?
- JUnit XML
- Allure Report (Correct answer)
- SonarQube
- Checkstyle
Correct answer: Allure Report
Allure Report provides rich, interactive HTML reports with screenshots, steps, and history integration widely used with Selenium test suites.
Which Maven plugin is commonly used to run Selenium/TestNG tests as part of a CI build?