5 Comments

It is always better to follow such rules:

- use real code for system's under test dependencies

- if not possible, replace it with test double (like in-memory database)

- if not possible, replace it with mock object

- never test behaviour (method X was invoked), test state or returned result

Expand full comment
author

I really like these guidances. Will incorporate them.

Expand full comment

What are some example unit test names? I am not clearly understanding the name format but examples would definitely help

Expand full comment

Maybe something like "When user fill incorrect email format, it should show invalid email format error"

Expand full comment
author

Here is an example:

testWhenEmailFormatIsInvalidShouldShowValidationError

Expand full comment