Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

ETLUnit 3.9.6

 

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.

Go to top

 

Syntax for a Test Class

Sample Test Class

Below is a sample ETLUnit test class.  It runs tests against Informatica work flows.

 

 

 

Full ETLUnit Test Class Example

@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'

);

}

}

 

Go to top

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.

 

Annotations Example

@Database(id: 'master')

@Database(id:'edw-pet')

class extract_master_to_edw_pet

{

      @Test

      colInOrder()

      {

      }

}

 

 

Test Class Declaration

A single ETLUnit test file may have any number of test classes in it.  It is good form to try to stick to only one test class per test file, and to use the same name for both the file and the declared test class.

The class declaration requires:

  1. The 'class' keyword
  2. The name of the class
  3. Delimiting curly braces

 

Test Class Example

@Database(id: 'master')

@Database(id:'edw-pet')

class extract_master_to_edw_pet

{

      @Test

      colInOrder()

      {

 

      }

}

 

Test Method Declaration

The test method sets apart a single 'test.'  A test class may have any number of test methods.

 

 

 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.