Skip to content

Testing

Evgeny Danilenko edited this page Oct 5, 2017 · 1 revision

Terms and main definitions

E2E

Question: "Is endpoint works properly with external systems"?

Description: Such tests should be written only for user endpoints. No mocks, stabs can be used. We should keep E2E tests close to production environment. For E2E testing we can use own fully functional private network.

Location: separate package 'e2e'.

Integration

Question: "Are this components works together"?

Description: Component level tests. We should use it in case if there is no possibility for unit testing. Mocks and stabs can be used, such as net/http/httptest.Server mock. It's important to keep integration tests fast, reliable and predictable.

Location: separate package 'integration'.

Unit

Question: "Is this method works correctly"?

Description: Function or method level tests. Should be as small as possible and do test of method in isolation of all the system. Mocks and stabs can be used.

Location: same level and package name as the tested code.