Fabricating Unit Test Data
MettleCI's powerful Unit Test capability allows developer to conduct unit testing using authored, intercepted, or fabricated data without having to alter your DataStage job design. Unit Tests are created, maintained, and monitored using the MettleCI Workbench. Unit Tests are executed using the Windows-based DataStage Designer or browser-based DataStage Flow Designer.
In order to use the Unit Test Feature, you'll need to
add 1 User Defined Environment Variable
add that environment variable as a parameter to each job for which you want to run unit tests
Step-by-step Guide
1. Fabricate Data for Input Source
Click on the ID data source, followed by the + button on the top right hand corner to determine the number of rows of data to fabricate

2. Save Fabricated Input Source
Remember to click on the Save button after preparing the source data

3. Output Data
If you know what the output is going to look like, you can enter it. Unit Testing will run the job and compare the actual output with the assumed output. It will report on any mismatch. On the other hand, if do not know what the output is going to look like, simply delete them by clicking on the Trash button.

7. Run DataStage Job in Unit Testing Mode
Run your DataStage Job in Unit Testing Mode by Enabled the pUnitTesting option

You'll be able to see dataStage job will now use the 2 fabricated rows for unit testing

8. Check Unit Tests List
Navigate back to Unit Tests List from the sidebar. You can now see Unit Test for ER_EMPLOYEE created.
Due to the fact that we did not specify an output for comparison. The result is in RED colour.

9. Output mismatch report
By clicking on the RED view result button above, it will bring you a summary report of the Unit Test

10. Baseline Output Data
If we go back to Unit Test Setting for TR_EMPLOYEE, we can now see the output of the first run is now set at the baseline of the output

11. Rerun Unit Test
If we rerun the Unit Test again, the test summary report will produce a report of perfect matched output.
