Don't Mock 3rd Party Code
Mocking can be a valuable tool in software testing, but mocking 3rd party libraries is nearly always a bad place to start. Dave Farley, author of books on Continuous Delivery and Software Engineering, demonstrates mocking 3rd party code with examples of code, tests and use of mocking, and how all are improved with good design choices.
If the code we are testing interacts with something else, then we probably want to know if this interaction happened, but it can be risky to use tools to generate mocks for third party code. People complain that it is complicated and results in tests being tightly coupled to the solution. This is not necessarily the fault of mocking though, it may be because the code is rubbish!
-----------------------------------------------------------------------------------
⭐ PATREON:
Join the Continuous Delivery community and access extra perks & content!
JOIN HERE ➡️ https://bit.ly/ContinuousDeliveryPatreon
-------------------------------------------------------------------------------------
📧 Join the CD Mail List here ➡️ https://www.subscribepage.com/cd-mail-list
FREE TDD TUTORIAL: Learn what it takes to get started and learn the skills of TDD, with a hands-on demonstration by Dave Farley ➡️ https://courses.cd.training/courses/tdd-tutorial
Want to learn more advanced TDD and BDD techniques?
🎓 https://courses.cd.training/courses/tdd-bdd-design-through-testing
With this course for software technicians, you'll learn how TDD and BDD combine to strengthen the design of your code, improve your programming skills and significantly reduce bugs in production.
-------------------------------------------------------------------------------------
🔗 LINKS
xUnit Patterns: http://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html
“Tell Don’t Ask”, Martin Fowler: https://martinfowler.com/bliki/TellDontAsk.html
-------------------------------------------------------------------------------------
👕 T-SHIRTS:
A fan of the T-shirts I wear in my videos? Grab your own, at reduced prices EXCLUSIVE TO CONTINUOUS DELIVERY FOLLOWERS! Get money off the already reasonably priced t-shirts!
🔗 Check out their collection HERE: https://bit.ly/3vTkWy3
🚨 DON'T FORGET TO USE THIS DISCOUNT CODE: ContinuousDelivery
-------------------------------------------------------------------------------------
📚 BOOKS:
📖 Dave’s NEW BOOK "Modern Software Engineering" is available as paperback, or kindle here ➡️ https://amzn.to/3DwdwT3
and NOW as an AUDIOBOOK available on iTunes, Amazon and Audible.
📖 The original, award-winning "Continuous Delivery" book by Dave Farley and Jez Humble ➡️ https://amzn.to/2WxRYmx
📖 "Continuous Delivery Pipelines" by Dave Farley
Paperback ➡️ https://amzn.to/3gIULlA
ebook version ➡️ https://leanpub.com/cd-pipelines
NOTE: If you click on one of the Amazon Affiliate links and buy the book, Continuous Delivery Ltd. will get a small fee for the recommendation with NO increase in cost to you.
-------------------------------------------------------------------------------------
CHANNEL SPONSORS:
Equal Experts is a product software development consultancy with a network of over 1,000 experienced technology consultants globally. They increase the pace of innovation by using modern software engineering practices that embrace Continuous Delivery, Security, and Operability from the outset ➡️ https://bit.ly/3ASy8n0
Roost, An Ephemeral DevOps Platform, automates your DevOps pipeline. It creates ephemeral DevOps environments on-demand or based on pull requests. Roost reduces DevOps complexities and shortens release cycles with fewer engineers. ➡️ https://bit.ly/CD2Roost
Tricentis is an AI-powered platform helping you to deliver digital innovation faster and with less risk by providing a fundamentally better approach to test automation. Discover the power of continuous testing with Tricentis. ➡️ https://bit.ly/TricentisCD
TransFICC provides low-latency connectivity, automated trading workflows and e-trading systems for Fixed Income and Derivatives. TransFICC resolves the issue of market fragmentation by providing banks and asset managers with a unified low-latency, robust and scalable API, which provides connectivity to multiple trading venues while supporting numerous complex workflows across asset classes such as Rates and Credit Bonds, Repos, Mortgage-Backed Securities and Interest Rate Swaps ➡️ https://transficc.com