Testing the Notify Package
Let’s write some tests for this package. To fully test this package, you’ll write unit tests and integration tests.
First, you’ll write unit tests for the package functions and methods, using a test file within the same package notify. For these tests, you’ll mock the command implementation using the same technique you applied in Testing Commands with Mock Resources, allowing you to fully automate the unit tests without generating screen notifications.
Then, you’ll also write integration tests to test the exposed API and ensure the notifications come up onscreen. This test is particularly important because this package doesn’t produce an executable file to try it out. To avoid having notifications displayed every ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access