diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-06-27 03:56:17 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-06-27 03:56:17 +0300 |
commit | 56c92ad22a1870641a804a5827a2a8e78e69c9be (patch) | |
tree | 023ca3737404831df417aa8282b587dbdcb15e79 /STYLE.md | |
parent | 925d587aa5e828636beddd4d7d57fbf2c306bcb8 (diff) |
Document outcome of black/white box discussion
Diffstat (limited to 'STYLE.md')
-rw-r--r-- | STYLE.md | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -107,4 +107,20 @@ instead of: func (server) GetBlob(_ *pb.GetBlobRequest, _ pb.BlobService_GetBlobServer) error { return helper.Unimplemented } -```
\ No newline at end of file +``` + +## Black box and white box testing + +The dominant style of testing in Gitaly is "white box" testing, meaning +test functions for package `foo` declare their own package also to be +`package foo`. This gives the test code access to package internals. Go +also provides a mechanism sometimes called "black box" testing where the +test functions are not part of the package under test: you write +`package foo_test` instead. Depending on your point of view, the lack of +access to package internals when using black-box is either a bug or a +feature. + +As a team we are currently divided on which style to prefer so we are +going to allow both. In areas of the code where there is a clear +pattern, please stick with the pattern. For example, almost all our +service tests are white box. |