Youtube Video

Summary published at 12/6/2024

📝 Reasons for Writing Tests: - Prevent software from breaking. - Change the way software is built and released.

Goals of Testing: 1. Prevent regression - Ensure that existing features continue to work. 2. Enable refactoring - Reduce fear of making changes. 3. Improve design - Encourage good coding practices.

🔍 System Test Example: - A large system test checks the entire application, including client app, backend servers, and data storage. - Example: "Test that spam posts are hidden" involves multiple dependencies and actions.

⚠️ Challenges with System Tests: - High fragility due to many dependencies. - Often results in a binary test suite (pass/fail) without fine-grained feedback. - Limited regression protection for small objects.

🚫 Common Failures in Testing: 1. Using Selenium as the primary testing mechanism leads to slow tests. 2. Writing large unit tests that resemble system tests increases runtime. 3. Writing fine-grained tests around legacy code can solidify bad practices.

⚙️ Unit Tests: - Focus on testing individual objects with minimal dependencies. - Faster execution compared to system tests. - Provide better regression protection and design feedback.

📊 Recommended Testing Ratios: - Aim for 90% unit tests and 10% system tests in the short term. - For new projects, consider 95% unit tests and 5% system tests.

🔄 Advice for Legacy Code: - Use system tests to gain confidence before refactoring. - Avoid writing fine-grained tests around bad code.

💡 Conclusion: - Focus on writing smaller, faster tests to improve feedback and design. - Balance between unit and system tests is crucial for effective testing strategy.

Download our Chrome extension for Youtube summaries