diff --git a/contributing/testing-best-practices.md b/contributing/testing-best-practices.md index ec6bbba587..a4226f4fe2 100644 --- a/contributing/testing-best-practices.md +++ b/contributing/testing-best-practices.md @@ -9,7 +9,9 @@ ## File structure -- Unit and Acceptances tests are in the same `_test.go` file. They are not in the same package as the code tests, e.g. `advancedcluster` tests are in `advancedcluster_test` package so coupling is minimized. +- Acceptances tests are in corresponding `_test.go` file as the resource or data source source file. +- General unit tests are in corresponding `_test.go` file as the resource or data source source file. If business logic is extracted into a separate file, unit testing for that logic will be including in its associated `_test.go` file (e.g. [state_transition_search_deployment_test.go](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/internal/service/searchdeployment/state_transition_search_deployment_test.go)). +- Tests are not in the same package as the code it tests, e.g. `advancedcluster` tests are in `advancedcluster_test` package so coupling is minimized. - Migration tests are in `_migration_test.go` files. - All resources need a `main_test.go` file to handle resource reuse lifecycle, e.g. [here](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/internal/service/advancedcluster/main_test.go). - Helper methods must have their own tests, e.g. `common_advanced_cluster_test.go` has tests for `common_advanced_cluster.go`.