Performance: Integration testing with Testing Library
LOW IMPACT
Integration testing affects development speed and feedback loop but does not impact runtime page load or rendering performance.
import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; // Render only the needed route or component render(<MyComponent />); // Use userEvent for realistic interaction const button = screen.getByRole('button'); await userEvent.click(button);
import { render } from '@testing-library/react'; // Rendering entire app with heavy data fetching mocks render(<App />); // No user-event simulation, direct DOM queries only const button = document.querySelector('button'); button.click();
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Render full app with heavy mocks | Many nodes rendered | Multiple reflows due to full render | High paint cost in test environment | [X] Bad |
| Render minimal component with userEvent | Minimal nodes rendered | Single reflow per test | Low paint cost | [OK] Good |