Рет қаралды 37,768
To mock or not to mock?
It's a good question that not everyone knows the answer to when developing tests.
To answer that, you need to know the concepts around mocking, what fake data and fake interactions are, the pros and cons, etc.
🚨 Subscribe to the newsletter: www.lucaspaganini.com/newsletter
📧 Email: me@lucaspaganini.com
🐦 Twitter: / lucaspaganini
📸 Instagram: / lucaspaganini
----------
CHAPTERS
0:00 Introduction
1:01 Fake Interactions
1:48 Fake data
2:25 When to mock
2:39 Mocking pros
4:02 Mocking cons
5:36 Best Practices of Mock Testing
7:02 Don't Stop Here
RELATED
1. Static, Unit, Integration, and End-to-End Tests Explained - • Static, Unit, Integrat...
REFERENCES
1. How to test software, part I: mocking, stubbing, and contract testing - CircleCI: circleci.com/blog/how-to-test...
2. What is Mocking in Testing? - Piraveena Paralogarajah on medium: / what-is-mocking-in-tes... )
3. What Is Mocking? - Typemock Blog: www.typemock.com/what-is-mock...
4. Hand-rolled mocks made easy - InfoWorld: www.infoworld.com/article/207...
5. xUnit Test Patterns: Refactoring Test Code - Gerard Meszaros on xUnit Patterns: xunitpatterns.com/
6. Generate dynamic mock data with Mockoon templating system - Mockoon: mockoon.com/tutorials/generat...
7. request - Cypress Documentation: docs.cypress.io/api/commands/...
8. Mock Testing - Devopedia: devopedia.org/mock-testing
9. Faker - Generate massive amounts of fake (but realistic) data for testing and development - Faker-js on GitHub: github.com/faker-js/faker
10. Retry, Rerun, Repeat - Cypress Blog: www.cypress.io/blog/2020/12/0...
11. Test Doubles: Can You Tell a Fake From a Mock? - WWT: www.wwt.com/article/test-doub...)
12. What's the difference between faking, mocking, and stubbing? - Stack Overflow: stackoverflow.com/questions/3...
13. Mocks Aren't Stubs - Martin Fowler: martinfowler.com/articles/moc...
#typescript #programming #testing