notexOPENOverview
Notex/Languages/Code Review: Basic Testing
05.16LESSON 16 OF 29 · 1 MIN READ

Code Review: Basic Testing

Always free to read
  • Take advantage of Go’s built-in testing framework to write idiomatic tests.

  • Make sure that tests cover positive and negative cases.

  • Use the testdata directory to hold data for running your tests.

  • Use t.Context() instead of context.Background().

  • Consider whether go-cmp would simplify comparisons.

  • Use table tests to validate the same logic with different data.

  • If your tests are independent (and they should be), use t.Parallel().

Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K