Write Unit Tests

Enable an agent to write unit tests Use when this capability is needed.

tomevault-io Updated

File contents

Write unit tests

Best practices

  • Unit tests should go into tests named for the functions being tested.
    • If you have a function Foo, you should have a test function named TestFoo.
    • Methods with receivers should include the name of the receiver's type. A method like func (f *Foo) Bar() {...} should have a test named TestFooBar.
  • Tests should only test the behavior of the function. Don't exhaustively test every possible input.
  • Each behavior you test should have a test case. If you have more than two test cases, use table-driven tests.

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/pevans--erc--write-unit-tests commit 5dfb32c657

Frequently asked questions

npx skillmds@latest add tomevault-io/write-unit-tests