React Native બહુ-સ્તરીય ટેસ્ટિંગને સમર્થન આપે છે — યુનિટ ટેસ્ટ્સ (તર્ક), કમ્પોનેન્ટ ટેસ્ટ્સ (React Native Testing Library સાથે), અને એન્ડ-ટુ-એન્ડ ટેસ્ટ્સ (Detox સાથે). એક સારી ટેસ્ટિંગ વ્યૂહરચના વિશ્વસનીયતા અને આત્મવિશ્વાસમાં વધારો કરે છે.
યુનિટ અને કમ્પોનેન્ટ ટેસ્ટિંગ (Jest + Testing Library)
JEST → the standard JS test runner (unit tests for logic, functions, hooks)
REACT NATIVE TESTING LIBRARY → test components by rendering and interacting with them
(the way a user would) — query elements, fire events, assert on output
{ render, fireEvent, screen } ;
(, {
();
fireEvent.(screen.());
(screen.()).();
});
