Hilt Testing Best Practices in the MAD Skills series

<p>his is the next MAD Skills article on&nbsp;<a href="https://dagger.dev/hilt/" rel="noopener ugc nofollow" target="_blank">Hilt</a>! This time we&rsquo;ll be focusing on how to write tests with Hilt and some of the best practices to be aware of.</p> <p>If you prefer to consume this content in a video format, check it out here:</p> <p><iframe frameborder="0" height="480" scrolling="no" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FoBpBWTb3k2g%3Flist%3DPLWz5rJ2EKKc_9Qo-RBRYhVmME1iR4oeTK&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DoBpBWTb3k2g&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FoBpBWTb3k2g%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" title="Hilt testing best practices - MAD Skills" width="854"></iframe></p> <h1>Hilt Testing Philosophy</h1> <p>Since Hilt is a more opinionated framework, the Hilt testing APIs are built with certain goals in mind. Knowing the approach Hilt takes toward testing will make the APIs a lot easier to use and understand. You can read more about the testing philosophy in depth&nbsp;<a href="https://dagger.dev/hilt/testing-philosophy" rel="noopener ugc nofollow" target="_blank">here</a>.</p> <p>One of the core goals of the testing APIs in Hilt is to avoid unnecessary usage of fakes or mocks in tests and to use real objects as much as possible instead. Real objects will increase test coverage and withstand changes over time much better than a fake or a mock. Fakes or mocks are useful when the real object is doing expensive tasks like IO, but they are often overused to cover up other problems where there isn&rsquo;t anything that conceptually can&rsquo;t be done in the test.</p> <p><a href="https://medium.com/androiddevelopers/hilt-testing-best-practices-in-the-mad-skills-series-8186a57eee2c">Read More</a></p>