Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Your Test Suite Is Making Too Many Database Calls

Ruby Central via YouTube

Overview

Discover strategies to optimize your test suite's performance in this RailsConf 2022 talk. Learn how to identify and reduce excessive database calls, profile and fix performance hot spots, and create visual diagrams for better understanding. Explore techniques to write query-resistant code, avoid persisting unnecessary data, and streamline shared test setups. Gain insights into improving factory designs, minimizing data creation, and implementing effective debugging methods. Master the art of balancing the testing pyramid and crafting minimal, extensible factories with traits. Equip yourself with the knowledge to significantly reduce build times and enhance overall test suite efficiency.

Syllabus

Intro
Negative effects of slow tests
Expensive things in tests
The testing pyramid
Avoid persisting data
Locations
Shared test setup
Tests with too much data
Tests with wrong data
Solution: Inline setup
Factories that do too much
Compounding factories
Minimal factory
Extend base with traits
Callbacks that create more data
Broken data
Updating in setup
Profiling factories
Diagramming
Organization
Diamond factories
Avoid creating extra data
Debugging techniques
Joel Quenneville

Taught by

Ruby Central

Reviews

Start your review of Your Test Suite Is Making Too Many Database Calls

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.