Sobes.tech
Senior

How does Data-Driven Testing (DDT) differ from regular automated testing?

sobes.tech AI

Answer from AI

Data-Driven Testing (DDT) differs from regular automated testing in that, in DDT, tests are executed using a set of input data provided externally (for example, from files, databases, or tables), rather than being hardcoded into the test.

Main differences:

  • Reusability of test logic: the same test function is run multiple times with different data.
  • Separation of data from code: test data is stored separately, making it easier to modify and extend.
  • Improved coverage: more scenarios can be tested without duplicating code.

Example in Python using pytest:

import pytest

@pytest.mark.parametrize("input,expected", [
    (1, 2),
    (3, 4),
    (5, 6),
])
def test_increment(input, expected):
    assert input + 1 == expected

Here, one test checks multiple data sets, which is the essence of DDT.

How does Data-Driven Testing (DDT) differ from… - sobes.tech