Mocking framework vs functional testing, why bother mocking? -
i understand mocking frameworks can override behavior of objects. makes test easier , faster. simulating objects behaviors in production environment can good. question arises mocking not developer ? @ end functional test (which real world test) show passed or failed. why prolong envitable ? why bother mocking object find out not working in production. why wait functional tester find out codes not working. if did not mock instead used real test find bugs right away instead of pleasing ourselves mocking. argument presented me , might philosphical thoughts on mocking framework vs real world unit testing
good question. after decade writing automated developer tests (and creating mocking library needs), can come conclusion unit tests use mocking not best way go.
instead, writing acceptance-level integration tests has worked better me. use mocking when there no easy way around it.
i suspect there still going take several years before developers share view, though. today, creating (and running) "real-world" integration tests harder mocking dependencies away, due lack of tooling support such tests; often, it's easier "cheat" , create bunch of unit tests mocking, rather take trouble of creating real tests exercise code in more realistic way.
Comments
Post a Comment