# TestDataSource attribute
> Version: _Available or changed with runtime version 18.0._
Specifies that the test method is data-driven. The runtime iterates the test cases supplied by the data provider and calls the method once per case. The method receives an object of interface ITestContext, or a user-defined interface that extends it.
## Applies to
 Method
> NOTE
> The TestDataSource attribute can only be set inside codeunits with the SubType property set to Test.
## Syntax
```al
[TestDataSource(DataSource: Integer, DataSetIdentifier: Text)]
```
### Arguments
DataSource
Type: ../methods-auto/integer/integer-data-type
The codeunit that implements ITestDataSource and supplies test data rows for this method.
DataSetIdentifier
Type: ../methods-auto/text/text-data-type
A string passed to ITestDataSource.ListTestCases and GetTestCase so that one provider codeunit can serve multiple test methods.
## Related information
Getting started with AL<../devenv-get-started>
Developing extensions<../devenv-dev-overview>
Test codeunits and test methods in AL<../devenv-test-codeunits-and-test-methods>
../methods-auto/datasourcecontext/datasourcecontext-data-type
../methods-auto/testhandlercontext/testhandlercontext-data-type

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/attributes/devenv-testdatasource-attribute, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/attributes/devenv-testdatasource-attribute/
