Testing / Karate Framework Interview questions
What is the match keyword used for in Karate?
match is Karate's core assertion keyword, used to compare an actual value (commonly a JSON or XML response) against an expected value or pattern. It supports deep, structural comparison of JSON and XML out of the box, without needing an external assertion library.
* match response == { id: 1, name: 'Alice', active: true } * match response.name == 'Alice' * match response == { id: '#number', name: '#string', active: '#boolean' }
Beyond exact equality, match supports fuzzy comparison through built-in type markers like #number or #string, and structural variants like contains for checking that a JSON object or array includes specific keys or elements without requiring an exact full match. This flexibility is what lets Karate validate complex, nested API responses in a single readable line instead of many individual field-by-field assertions.
More Related questions...