User Tools

Site Tools


data-driven_testing

This is an old revision of the document!


Source: Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich

Data-based testing

DBT is an approach to testing in which one test function is executed multiple times with different sets of input data. This makes it easy to cover more cases and reduce code duplication.cases.

Strengths of DBT

  1. They eliminate duplication of tests with different input data.
  2. They simplify the coverage expansion: you add a row of data, and you have a new test.
  3. They increase the readability and maintainability of tests.

Best practices

  1. Try to keep the data next to the tests (CsvSource, InlineData) for simple cases.
  2. For large sets, use separate CSV/JSON files.
  3. Do not overload the test with unnecessary cases — it is better to divide it into logical groups.
  4. In Go, use table-driven tests as a standard — it's readable and familiar.
data-driven_testing.1757479237.txt.gz · Last modified: by plida