logoalt Hacker News

locknitpickertoday at 11:49 AM0 repliesview on HN

> 100%. its a horrible code smell (...)

It's a testing technique used particularly in legacy projects called characterization tests. If you are faced with covering with tests a component you didn't wrote and you don't want to introduce a regression when refactoring it, you just mock existing function calls to assert observable behavior.

In compiled languages such as C++ this is even done with link time stubs.

Calling it code smell conveys the idea you are inexperienced and lack any experience managing test coverage.