How Are Nullables Different From Mocks?

3 views
Skip to first unread message

James Shore

unread,
May 3, 2023, 12:25:13 PM5/3/23
to jamesshor...@googlegroups.com
Hi everyone,

One of the most common questions I get about #nullables is, “How is that any different than a mock?”

The short answer is that Nullables result in sociable, state-based tests, and mocks (and spies) result in solitary, interaction-based tests. This has two major benefits:

1. Nullables catch bugs that mocks don't.
2. Nullables don't break when you refactor.

I go into more detail here:


PS: If you’re interested in #nullables and other “Testing Without Mocks” ideas, I have a live online course coming up on June 6th. You can learn more at https://www.jamesshore.com/s/nullables-training?js-list .

Cheers,
James

--
James Shore - The Art of Agile

voice: +1 503-267-5490
blog: jamesshore.com

Reply all
Reply to author
Forward
0 new messages