singer_sdk.testing.templates.TestTemplate

class singer_sdk.testing.templates.TestTemplate[source]

Each Test class requires one or more of the following arguments.

Parameters:

runner (SingerTestRunner) – The singer runner for this test.

Possible Args:

stream (obj, optional): Initialized stream object to be tested. stream_name (str, optional): Name of the stream to be tested. attribute_name (str, optional): Name of the attribute to be tested.

Raises:
run(config, resource, runner)[source]

Test main run method.

Parameters:
  • config (SuiteConfig) – SuiteConfig instance, to use for test.

  • resource (t.Any) – A generic external resource, provided by a pytest fixture.

  • runner (_T) – A Tap or Target runner instance, to use with this test.

Raises:

ValueError – if Test instance does not have name and type properties.

Return type:

None

setup()[source]

Test setup, called before .test().

This method is useful for preparing external resources (databases, folders etc.) before test execution.

Raises:

NotImplementedError – if not implemented.

Return type:

None

teardown()[source]

Test Teardown.

This method is useful for cleaning up external resources (databases, folders etc.) after test completion.

Raises:

NotImplementedError – if not implemented.

Return type:

None

test()[source]

Main Test body, called after .setup() and before .validate().

Return type:

None

validate()[source]

Test validation, called after .test().

This method is particularly useful in Target tests, to validate that records were correctly written to external systems.

Raises:

NotImplementedError – if not implemented.

Return type:

None

property id: str[source]

Test ID.

Raises:

NotImplementedError – if not implemented.