...

/

Building the Foundation for End to End Tests

Building the Foundation for End to End Tests

In this lesson, you’ll learn where to put end-to-end tests, and we'll discuss how to build a solid foundation for end-to-end tests, which is very different from unit tests.

Locating end-to-end tests

In Go, unit tests reside in the directory of the package they test. Where should you put end-to-end tests? For a command-line program like multi-git that has a single command called mg in the cmd directory, it makes sense to place the end-to-end tests there:

├── multi-git
│   ├── cmd
│   │   └── mg

However, I think of end-to-end tests as a separate entity that is not embedded with the code it is testing. The whole concept of black-box testing and testing from the outside suggests that testing in different locations is better. Also, in larger systems, there will be many artifacts, services, applications, tools, ...