Skip to content


Write tests to prevent regressions and write better code.


It's generally recommended to test your application without tying the tests too closely to MUI. This is how MUI components are tested internally. A library that has a first-class API for this approach is @testing-library/react.

For example, when rendering a TextField your test should not need to query for the specific MUI instance of the TextField but rather for the input, or [role="textbox"].

By not relying on the React component tree you make your test more robust against internal changes in MUI or, if you need snapshot testing, adding additional wrapper components such as context providers. We don't recommend snapshot testing though. "Effective snapshot testing" by Kent C. Dodds goes into more details why snapshot testing might be misleading for React component tests.


MUI has a wide range of tests so we can iterate with confidence on the components, for instance, the visual regression tests provided by Argos-CI have proven to be really helpful. To learn more about the internal tests, you can have a look at the README.