What is Mocking? - Concepts and Best Practices - Software Testing Series #2

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: https://www.lucaspaganini.com/newsletter šŸ“§ Email: [email protected] 🐦 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,Ā Integration,Ā andĀ End-to-EndĀ ...Ā Ā  REFERENCES 1. How to test software, part I: mocking, stubbing, and contract testing - CircleCI: https://circleci.com/blog/how-to-test... 2. What is Mocking in Testing? - Piraveena Paralogarajah on medium: Ā Ā /Ā what-is-mocking-in-testingĀ Ā ) 3. What Is Mocking? - Typemock Blog: https://www.typemock.com/what-is-mock... 4. Hand-rolled mocks made easy - InfoWorld: https://www.infoworld.com/article/207... 5. xUnit Test Patterns: Refactoring Test Code - Gerard Meszaros on xUnit Patterns: http://xunitpatterns.com/ 6. Generate dynamic mock data with Mockoon templating system - Mockoon: https://mockoon.com/tutorials/generat... 7. request - Cypress Documentation: https://docs.cypress.io/api/commands/... 8. Mock Testing - Devopedia: https://devopedia.org/mock-testing 9. Faker - Generate massive amounts of fake (but realistic) data for testing and development - Faker-js on GitHub: https://github.com/faker-js/faker 10. Retry, Rerun, Repeat - Cypress Blog: https://www.cypress.io/blog/2020/12/0... 11. Test Doubles: Can You Tell a Fake From a Mock? - WWT: https://www.wwt.com/article/test-doub...) 12. What's the difference between faking, mocking, and stubbing? - Stack Overflow: https://stackoverflow.com/questions/3... 13. Mocks Aren't Stubs - Martin Fowler: https://martinfowler.com/articles/moc... #typescript #programming #testing

Thoughts About Unit Testing | Prime Reacts
ā–¶ļøŽ

Thoughts About Unit Testing | Prime Reacts

Static, Unit, Integration, and End-to-End Tests Explained - Software Testing Series #1
ā–¶ļøŽ

Static, Unit, Integration, and End-to-End Tests Explained - Software Testing Series #1

Unit Testing (Vitest) Tutorial #11 - Mock Functions
ā–¶ļøŽ

Unit Testing (Vitest) Tutorial #11 - Mock Functions

What 6 months of AI coding did to my dev team
ā–¶ļøŽ

What 6 months of AI coding did to my dev team

Mocks vs. Fakes vs. Stubs | Mocking in Java | Mock Frameworks | Geekific
ā–¶ļøŽ

Mocks vs. Fakes vs. Stubs | Mocking in Java | Mock Frameworks | Geekific

JS Unit Testing Good Practices & Horrible Mistakes • Roy Osherove • GOTO 2013
ā–¶ļøŽ

JS Unit Testing Good Practices & Horrible Mistakes • Roy Osherove • GOTO 2013

What is Regression Testing? A Software Testing FAQ - Why? How? When?
ā–¶ļøŽ

What is Regression Testing? A Software Testing FAQ - Why? How? When?

How To Write Unit Tests (The Right Way)
ā–¶ļøŽ

How To Write Unit Tests (The Right Way)

5 Types of Testing Software Every Developer Needs to Know!
ā–¶ļøŽ

5 Types of Testing Software Every Developer Needs to Know!

Fuzzing (fuzz testing) 101: Lessons from cyber security expert Dr. David Brumley
ā–¶ļøŽ

Fuzzing (fuzz testing) 101: Lessons from cyber security expert Dr. David Brumley

Mocking a Database in Node with Jest
ā–¶ļøŽ

Mocking a Database in Node with Jest

Mocking in C# Unit Tests - How To Test Data Access Code and More
ā–¶ļøŽ

Mocking in C# Unit Tests - How To Test Data Access Code and More

Getting started with Mocking using Moq in .NET (Core, Framework, Standard)
ā–¶ļøŽ

Getting started with Mocking using Moq in .NET (Core, Framework, Standard)

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains
ā–¶ļøŽ

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

Introduction To Testing In JavaScript With Jest
ā–¶ļøŽ

Introduction To Testing In JavaScript With Jest

C++ testing with mocks is EASY and awesome!
ā–¶ļøŽ

C++ testing with mocks is EASY and awesome!

JavaScript Testing - Mocking Async Code
ā–¶ļøŽ

JavaScript Testing - Mocking Async Code

JavaScript Unit Testing Tutorial for Beginners
ā–¶ļøŽ

JavaScript Unit Testing Tutorial for Beginners

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup
ā–¶ļøŽ

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

SOLID Principles: Do You Really Understand Them?
ā–¶ļøŽ

SOLID Principles: Do You Really Understand Them?