From 0840642c9814b633aeaedf1a8358ea009328a803 Mon Sep 17 00:00:00 2001 From: RoyUP9 <87927115+RoyUP9@users.noreply.github.com> Date: Tue, 14 Sep 2021 16:57:39 +0300 Subject: [PATCH] testing guidelines (#276) --- .github/TESTING.md | 33 +++++++++++++++++++++++++++++++++ TESTING.md | 15 --------------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 .github/TESTING.md delete mode 100644 TESTING.md diff --git a/.github/TESTING.md b/.github/TESTING.md new file mode 100644 index 000000000..f79a575f1 --- /dev/null +++ b/.github/TESTING.md @@ -0,0 +1,33 @@ +![Mizu: The API Traffic Viewer for Kubernetes](../assets/mizu-logo.svg) +# Testing guidelines + +## Generic guidelines +* Use "[testing](https://pkg.go.dev/testing)" package +* Write [Table-driven tests using subtests](https://go.dev/blog/subtests) +* Use cleanup in test/subtest in order to clean up resources +* Name the test func "Test" + +## Unit tests +* Position the test file inside the folder of the tested package +* In case of internal func testing + * Name the test file "_internal_test.go" + * Name the test package same as the package being tested + * Example - [Config](../cli/config/config_internal_test.go) +* In case of exported func testing + * Name the test file "_test.go" + * Name the test package "_test" + * Example - [Slice Utils](../cli/mizu/sliceUtils_test.go) +* Make sure to run test coverage to make sure you covered all the cases and lines in the func + +## Acceptance tests +* Position the test file inside the [acceptance tests folder](../acceptanceTests) +* Name the file "_test.go" +* Name the package "acceptanceTests" +* Do not run as part of the short tests +* Use/Create generic test utils func in acceptanceTests/testsUtils +* Don't use sleep inside the tests - active check +* Running acceptance tests locally + * Switch to the branch that is being tested + * Run acceptanceTests/setup.sh + * Run tests (make acceptance-test) +* Example - [Tap](../acceptanceTests/tap_test.go) diff --git a/TESTING.md b/TESTING.md deleted file mode 100644 index a9e7b793b..000000000 --- a/TESTING.md +++ /dev/null @@ -1,15 +0,0 @@ -![Mizu: The API Traffic Viewer for Kubernetes](assets/mizu-logo.svg) -# TESTING -Testing guidelines for Mizu project - -## Unit-tests -* TBD -* TBD -* TBD - - - -## System tests -* TBD -* TBD -* TBD