React · Senior · Question 43 of 75

What principle underlies React Testing Library?

Explanation

Queries like getByRole('button', { name: 'Save' }) check behavior and accessibility at the same time and don't break when internals are refactored. Interactions are simulated with user-event. Tests of implementation details are brittle and guarantee little.

Further reading

Problem with a question

React · Senior · question 43

Test yourself

Take the React · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz