All quizzesHard
Testing Architecture
Preview — 3 of 10 questions
What is property-based testing?
javascript
test("reverse function", () => {
expect(reverse([1,2,3])).toEqual([3,2,1]);
expect(reverse([])).toEqual([]);
expect(reverse([1])).toEqual([1]);
// Only tested 3 cases
});ATesting properties of objects.
BGenerating random inputs and verifying properties hold for all inputs.
CTesting based on object properties only.
DA deprecated testing concept.
What is mutation testing?
javascript
function isAdult(age) {
return age >= 18; // Original code
}
// Mutation 1: Change >= to >
function isAdult(age) {
return age > 18; // Mutated
}
// If tests don't fail, they're not thorough enough!
// Test should check: isAdult(18) === trueATesting code mutations in production.
BIntroducing small code changes (mutations) and checking if tests fail.
CMutating test data.
DTesting code that mutates objects.
What is contract testing in microservices?
javascript
Consumer service calls: POST /api/users with { name: "Alice" }
Provider service responds: { id: 1, name: "Alice", email: "alice@example.com" }
If consumer later calls: POST /api/users
And provider changes response to: { id: 1, name: "Alice" } (removes email)
Consumer code expecting email breaks!
Contract test catches this BEFORE deployment.ATesting contracts (legal agreements).
BTesting that API consumer and provider agree on contract (request/response format).
CTesting service contracts as documents.
DTesting service dependencies only.
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.