Repeatable Unit Tests require that the job under test produce deterministic data based on a set of predefined inputs and parameters. Calculations based on the current date are common in DataStage jobs but will cause the output produced by jobs to change depending on the date the job executed. This page outlines practices that can ensure jobs using current date calculations can be tested.
Transformer Stages using CurrentDate(), CurrentTime() or CurrentTimestamp() functions
Unless your date calculation requires an exact date/time a record was being processed, the standard CurrentDate()
, CurrentTime()
and CurrentTimestamp()
functions can be substituted with the DSJobStartDate
, DSJobStartTime
and DSJobStartTimestamp
macros which can be to a specific value during testing using the parameters clause of the Unit Test Specification
... when: parameters: DSJobStartDate: 2012-01-15 DSJobStartTime: 11:05:01