Hank Sola
- About: I blog about Perl. Well, soon maybe!
Recent Actions
-
Commented on Sick of being mocked by unit tests
Here is what I dislike about unit tests: They do not necessarily transfer when you refactor. For example, if you add a helper class or move methods from one class to another, your unit tests will have to change. now,...
Comment Threads
-
Steven Haryanto commented on
Sick of being mocked by unit tests
Perhaps Test::MockTime is the only useful mock? For other things like filesystem, database, just use the real thing.
-
Aristotle commented on
Sick of being mocked by unit tests
One of the better articles I’ve read in this back&forth:
Gary Bernhardt: Test Isolation Is About Avoiding Mocks
-
Ether commented on
Sick of being mocked by unit tests
Nice post. I also loathe mocked objects nearly universally. Also, some implementations are problematic -- e.g. Test::MockObject on the CPAN has a number of implementation issues that cause me to pull its use out of any project I can.
Here's one module I wrote which stands in for the server side of a client-server communication: https://metacpan.org/pod/Test::LWP::UserAgent - useful when you are writing a network client to communicate with a third-party server, and you want to simulate various behaviours of the server. Obvi…
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.