Edit

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

[TestDataSource(DataSource: Integer, DataSetIdentifier: Text)]

Arguments

DataSource
 Type: Integer
The codeunit that implements ITestDataSource and supplies test data rows for this method.

DataSetIdentifier
 Type: Text
A string passed to ITestDataSource.ListTestCases and GetTestCase so that one provider codeunit can serve multiple test methods.

Getting started with AL
Developing extensions
Test codeunits and test methods in AL
DataSourceContext data type
TestHandlerContext data type