zk-kit icon indicating copy to clipboard operation
zk-kit copied to clipboard

Write better test cases titles

Open 0xjei opened this issue 1 year ago • 0 comments

Context

The zk-kit packages test cases ('it') follows the same format. Some of them seems unclear and can be improved (e.g., Should not import a tree if it the exported tree is not defined).

Approach

We can define a more strict convention that must be followed for the definition of clearer test case statements.

Guidelines

  • Clear and Descriptive Titles: Ensure each test case clearly describes what it tests.
  • Behavior-Driven Phrasing: Use BDD-style phrasing, often starting with "should," to describe expected behavior.
  • Specificity: Be specific about what each test case is verifying, especially regarding conditions and expected outcomes.
  • Single Aspect Testing: Aim to test one aspect or behavior in each it block to simplify diagnosis when tests fail.
  • Consistent Structure: Maintain a consistent structure and phrasing style across all test descriptions for readability and maintainability.
  • Reflect User Stories: Where possible, align test cases with user stories or requirements to ensure they meet the specified criteria.
  • Language Consistency: Use consistent language and tense (present simple or future simple) throughout your test descriptions.

References

  • ChatGPT
  • https://testsigma.com/guides/test-cases-for-manual-testing/#How_to_write_test_cases_A_step-by-step_guide

0xjei avatar Feb 12 '24 13:02 0xjei