{"title":"TestDataSource attribute","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/attributes/devenv-testdatasource-attribute/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/attributes/devenv-testdatasource-attribute","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Specifies that the test method is data-driven.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":312,"chars":132},{"level":2,"title":"Syntax","slug":"syntax","at":444,"chars":434},{"level":3,"title":"Arguments","slug":"arguments","at":527,"chars":351},{"level":2,"title":"Related information","slug":"related-information","at":878,"chars":322}],"text":"> Version: _Available or changed with runtime version 18.0._\nSpecifies 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.\n## Applies to\n Method\n> NOTE\n> The TestDataSource attribute can only be set inside codeunits with the SubType property set to Test.\n## Syntax\n```al\n[TestDataSource(DataSource: Integer, DataSetIdentifier: Text)]\n```\n### Arguments\nDataSource\nType: ../methods-auto/integer/integer-data-type\nThe codeunit that implements ITestDataSource and supplies test data rows for this method.\nDataSetIdentifier\nType: ../methods-auto/text/text-data-type\nA string passed to ITestDataSource.ListTestCases and GetTestCase so that one provider codeunit can serve multiple test methods.\n## Related information\nGetting started with AL<../devenv-get-started>\nDeveloping extensions<../devenv-dev-overview>\nTest codeunits and test methods in AL<../devenv-test-codeunits-and-test-methods>\n../methods-auto/datasourcecontext/datasourcecontext-data-type\n../methods-auto/testhandlercontext/testhandlercontext-data-type"}