summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Woodbine <caleb@ii.coop>2019-10-01 15:46:28 +1300
committerCaleb Woodbine <caleb@ii.coop>2019-10-08 11:43:09 +1300
commit4b163904444fac41aff83e2760b7f31bf3751200 (patch)
tree8a69f0cb7a68e872a798867ac0f30238a53a74f5
parent3d473c3da002c5f71a20424b8f73eecd3ccdc5d5 (diff)
Add logging documentation
-rw-r--r--contributors/devel/sig-testing/writing-good-e2e-tests.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/contributors/devel/sig-testing/writing-good-e2e-tests.md b/contributors/devel/sig-testing/writing-good-e2e-tests.md
index 39727ea5..10c7c341 100644
--- a/contributors/devel/sig-testing/writing-good-e2e-tests.md
+++ b/contributors/devel/sig-testing/writing-good-e2e-tests.md
@@ -244,3 +244,23 @@ For example:
3. although the clusters used for testing are generally beefy, an overamount of resources should not be created as it is unnecessary
4. using afterEach, make sure that your test destroys any resources leftover from the test
+### Logging ###
+When writing tests, it's often useful to have logging of events which take place (at least during the development of the given test).
+To log, import the module `framework`. Once included, in the test, you will be able to call `framework.Logf`.
+
+#### Example usage ####
+1. Printing a single string wrapped in a string
+```golang
+testvar := "Hello World"
+framework.Logf("Logf says: '%v'", testvar)
+```
+
+2. Printing a string and a number wrapping in a string
+```golang
+testvar1 := "a string"
+testvar2 := 1
+framework.Logf("testvar1: %v; testvar2: %v", testvar1, testvar2)
+```
+
+For more information, please refer to [the framework documentation](https://godoc.org/k8s.io/kubernetes/test/e2e/framework#Logf)
+