Draft in Progress
This document is a draft and is under development.
Creating a New Test Class
How to Create a Test Class
Create an ETLUnit test class with any ASCII compatible text editor.
Test Class File Naming
- The name of the file containing the test class should end with the extension, '
.etlunit
.' - The file name does not have to have the same name as the test class.
- The file may contain multiple test classes.
Test Class Content Format
The syntax used in ETLUnit test classes is proprietary to ETLUnit. In appearance, it appears to be a cross between an object oriented programming language like Java, and JSON syntax. SEE the Test Class Declaration example below.
Syntax for a Test Class
Sample Test Class
Below is a sample ETLUnit test class. It runs tests against Informatica work flows.
@JoinSuite(name:'bucket_v2')
@JoinSuite(name:'aud')
@JoinSuite(name:'omc')
@Database(id: 'edw', modes: ['src'])
class gap_bucket
{
@Test
columnsloadinorder_bucket()
{
stage(
file: 'FF_BUCKET_V2.txt',
classifier: 'source'
);
stage(
source: 'BUCKET_V1_GAP',
connection-id: 'edw',
target-table: 'BUCKET'
);
execute(
workflow: 'wkf_GAP_FILLER_CREATE_V1_BUCKET_DELTA',
folder: 'EDW_QPT_BUCKET',
context:
{
edw-connection-src: 'informatica.connections.edw.src',
edw-connection-tgt: 'informatica.connections.edw.tgt'
}
);
assert(
source-file: 'FF_BUCKET_V1_DELTA_20130312',
reference-file-type: 'gap_bucket'
);
}
@Test
Filter_bucket_Detail()
{
stage(
file: 'FF_BUCKET_V2.txt',
classifier: 'source'
);
stage(
source: 'BUCKET_DETAIL_V1_FIL_GAP',
connection-id: 'edw',
target-table: 'BUCKET_DETAIL'
);
execute(
workflow: 'wkf_GAP_FILLER_CREATE_V1_BUCKET_DETAIL_DELTA',
folder: 'EDW_QPT_BUCKET',
context:
{
edw-connection-src: 'informatica.connections.edw.src',
edw-connection-tgt: 'informatica.connections.edw.tgt'
}
);
assert(
target: 'FF_BUCKET_DETAIL_FIL_V1_DELTA_20130312',
source-file:'FF_BUCKET_DETAIL_V1_DELTA_20130312',
reference-file-type: 'gap_bucket_detail'
);
}
}
Parts of a Test Class
The ETLUnit Test Class
Annotations may be placed at the file, class or method levels. Annotations begin with the '@' symbol. Here is an example.
0 Comments