Can I unit test Informatica Powercentre workflows?
Can I unit test Informatica Powercentre workflows?
EDIT: More specifically, can I mock sources and target and test the steps in between? Eg. If I have a workflow with a Oracle source and a text file target ca开发者_JS百科n I test it without Oracle and a text file.?
No you can't.
When you create and save a mapping Informatica validates if the mapping is syntactically valid. It will give you an error message if it's not. Look for the errors in the bottom panel. You can validate a mapping by going to Mappings Menu > Validate.
You can validate a workflow similarly : Workflows Menu > Validate.
To run the workflow it is necessary that you have the source and target available and connected. If you don't want to write to target or don't want to do full volume testing you can use "Enable Test Load" at the Session level (Edit > Properties > Enable Test Load) and set "Number of rows to test".
Yes, you can run the work flow and test the output target table. (From the work flow manager, right click on a work flow, and click "run work flow from start".
Once the work flow is successful, view the data in the target to see of the mappings and transformations are working fine.
Just like any other Unit testing, you'll need to identify the records in your source (and target) and the expected results in the target before you run your work flow.
Eg If I want to test a mapping which has the SCD type2 logic, you can run the work flow twice and update the source columns as needed and after running the work flow, check if the current record has been updated correctly and if the new row for a history version of the record has been updated correctly.
What we're trying to do in Informatica is build a source file, build an expected output file and then run a workflow to produce an actual output file. We then do a bytecode comparison of our expected output file versus our actual output file. What we're actually testing for here is whether or not our mapping logic is implemented as we believe it should be implemented.
The following python script will do the testing:
import filecmp
import csv
import sys
testRepository = open('testRepository.txt','rb')
testReader = csv.reader(testRepository)
print 'Test Number\tResult'
for test in testReader:
print test[0] + '\t\t' + str(filecmp.cmp(test[1], test[2]))
Not exactly mocking, but essentially will be what's necessary to correctly test that your mapping is correct. Validity of the mapping is checked my Informatica itself.
精彩评论