CDP Testing & Quality Assurance 2 — Questions and Answers
Question 1: Which testing framework is commonly used for behavior-driven development (BDD) in DevOps pipelines?
- JUnit
- Cucumber (Correct answer)
- Mockito
- Pytest
Correct answer: Cucumber
Cucumber enables BDD by allowing teams to write tests in Gherkin (Given/When/Then) syntax, bridging communication between technical and non-technical stakeholders.
Question 2: What is the purpose of a smoke test in a DevOps deployment pipeline?
- To test every feature in depth after deployment
- To verify that the most critical functions work after a build or deployment (Correct answer)
- To measure application performance under load
- To check code style compliance
Correct answer: To verify that the most critical functions work after a build or deployment
Smoke tests are a quick sanity check that the core functionality works after a deployment, preventing broken builds from advancing further.
Question 3: Which tool is widely used to measure code coverage in Java-based DevOps projects?
- SonarQube
- JaCoCo (Correct answer)
- Selenium
- Gatling
Correct answer: JaCoCo
JaCoCo (Java Code Coverage) is the standard library for measuring code coverage in Java projects and integrates seamlessly with Maven, Gradle, and CI tools.
Question 4: What is contract testing in a microservices DevOps environment?
- Testing that SLAs defined in vendor contracts are met
- Verifying that service interfaces conform to agreed-upon API specifications between consumers and providers (Correct answer)
- Testing network firewall rules between services
- Validating database schema migrations
Correct answer: Verifying that service interfaces conform to agreed-upon API specifications between consumers and providers
Contract testing ensures that the API 'contract' between a consumer and provider service is honored, preventing integration failures when services are deployed independently.
Question 5: In automated UI testing, which tool is most commonly integrated into CI/CD pipelines for browser-based end-to-end tests?
- Ansible
- Terraform
- Selenium WebDriver (Correct answer)
- Nagios
Correct answer: Selenium WebDriver
Selenium WebDriver automates browser interactions and is widely used in CI/CD pipelines for end-to-end UI testing across multiple browsers.
Question 6: What is the key difference between functional testing and non-functional testing?
- Functional testing is manual; non-functional is automated
- Functional testing verifies what the system does; non-functional testing verifies how well it does it (Correct answer)
- Functional testing covers security; non-functional covers performance
- Functional testing happens after deployment; non-functional before
Correct answer: Functional testing verifies what the system does; non-functional testing verifies how well it does it
Functional testing validates features and business logic, while non-functional testing assesses quality attributes like performance, scalability, and reliability.
Question 7: Which practice ensures that test environments are consistent and reproducible in a DevOps pipeline?
- Manual environment setup by QA engineers
- Environment provisioning using Infrastructure as Code (Correct answer)
- Sharing a single permanent test environment across all teams
- Using production data directly in test environments
Correct answer: Environment provisioning using Infrastructure as Code
Using IaC tools like Terraform or Ansible to provision test environments ensures they are identical, version-controlled, and can be created on demand for each pipeline run.
Which testing framework is commonly used for behavior-driven development (BDD) in DevOps pipelines?