CAD Continuous Integration and Testing 3 — Questions and Answers
Question 1: What distinguishes Behavior-Driven Development (BDD) from Test-Driven Development (TDD)?
- BDD focuses on system performance, TDD on unit correctness
- BDD uses natural language specifications shared with stakeholders; TDD uses code-level tests written by developers (Correct answer)
- BDD is done after coding; TDD is done before
- BDD replaces unit tests; TDD replaces integration tests
Correct answer: BDD uses natural language specifications shared with stakeholders; TDD uses code-level tests written by developers
BDD extends TDD by expressing tests in human-readable language (e.g., Gherkin) to align developers, testers, and business stakeholders.
Question 2: In contract testing for microservices, what does the 'consumer' define?
- The API schema for all services
- The expectations about the provider's responses that it relies on (Correct answer)
- The deployment schedule for the service
- The performance SLA for the provider
Correct answer: The expectations about the provider's responses that it relies on
Consumer-driven contract testing lets each consumer specify exactly what it needs from a provider, enabling independent deployability.
Question 3: What is 'shift-left testing' in Agile development?
- Moving testing activities earlier in the development lifecycle (Correct answer)
- Assigning testing responsibilities to left-handed team members
- Running regression tests only at sprint end
- Shifting QA work to a separate team
Correct answer: Moving testing activities earlier in the development lifecycle
Shift-left means catching defects as early as possible—during design and coding—rather than in late-stage QA phases.
Question 4: Which type of test verifies that independently developed modules work correctly together?
- Unit test
- Smoke test
- Integration test (Correct answer)
- Exploratory test
Correct answer: Integration test
Integration tests validate the interactions and data flow between two or more components or services.
Question 5: A CI pipeline runs static code analysis. What is the primary benefit?
- It replaces the need for unit tests
- It catches code quality issues, security vulnerabilities, and style violations automatically before merge (Correct answer)
- It measures application performance under load
- It generates user acceptance test cases
Correct answer: It catches code quality issues, security vulnerabilities, and style violations automatically before merge
Static analysis tools scan code without executing it, catching bugs, code smells, and security issues early in the pipeline.
Question 6: What is 'trunk-based development' and how does it relate to CI?
- Developing features directly on a single main branch with very short-lived feature branches, enabling true CI (Correct answer)
- Maintaining separate trunks for each developer
- A branching strategy where releases are made from trunk after 6-month cycles
- Using a trunk server to host all CI agents
Correct answer: Developing features directly on a single main branch with very short-lived feature branches, enabling true CI
Trunk-based development maximizes integration frequency by keeping branches short-lived or absent, which is a prerequisite for genuine CI.
Question 7: When should acceptance tests be automated in an Agile CI pipeline?
- Only after the project reaches production
- As part of the Definition of Done, so they run on every build (Correct answer)
- Only for regression testing at year-end
- After manual QA signs off on each story
Correct answer: As part of the Definition of Done, so they run on every build
Automating acceptance tests as part of the DoD ensures every build is verified against business requirements without manual intervention.
What distinguishes Behavior-Driven Development (BDD) from Test-Driven Development (TDD)?