100% Guaranteed Results


Testing go – # Exercise 6 Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

In this exercise, you will create a mock object for service to emulate specific behavior without reaching out to external services and/or components.

1. Navigate to the directory `start`. You will find an existing Go project.
2. Inspect the functionality of the project.
3. Add the external package Testify by running `go get github.com/stretchr/testify`.
4. Create a new test file named `shopping_test.go`.
5. Write a test case for the function `CheckoutShoppingCart`. Create a mock object for `Notifier` and provide it when creating `PurchaseService`. Emulate the use case where a customer could check out the shopping cart and a message could be sent successfully.
6. Execute the test case to ensure that it passes.
7. Write a test case for the function `CheckoutShoppingCart`. Create a mock object for `Notifier` and provide it when creating `PurchaseService`. Emulate the use case where a customer could check out the shopping cart but the notifier returns with an error. 8. Execute the test case to ensure that it passes.

Reviews

There are no reviews yet.

Be the first to review “Testing go – # Exercise 6 Solved”

Your email address will not be published. Required fields are marked *

Related products