You are on page 1of 23

http://htmlimg1.scribdassets.com/2p1k22iqo02e29ff/images/2-f24d513433.

jpg

Case Study for Testing the Business requirements atInformatica workflow level by
manipulating the file inUnix environment.
=================

Preface

In projects where Informatica (or any other tool) is used to performthe data
migration , it is driven by certain business rules. This is acase study to validate
some of these business rules by manipulating
the files in Unix server, it allows testers to validate the business
requirements at Informatica workflow level also if Informatica server is installed
in Unix, it becomes important for us to perform suchvalidations
=========================
ValidationsIn ETL Projects there are certain validations like

Record Count check.

Duplicate data check.

Data check in the target file.We usually have to write certain SQL queries to test
thesevalidations in all our projects which sometimes is tedious job.
To save our time every time when we have to perform such
operations (which is generic to all ETL projects) and to make thetesting more
effective at the workflow level in Informatica we canperform certain steps at Unix
level which is being discussed in thispresentation
=============
Sample Business Requirements

These are some sample business requirements which we normally comeacross in


data migration projects.1.Source file should have two line header.2. Source file
should have the count of records in the trailer.3. Source file should not have
more then 50% of the records available in the filefor previous business date (max
count)4. File taken as input should have min 10 records (min count)
========

Validation Procedures

There are two ways of testing the above requirements :- A.FTP the file to local
drive, make the necessary changes and thenupload the file again and run the
Informatica mapping
B. Using the VI editor, open and edit the file in Unix server itself
=====================
FTP Method
Go the source location of the file using the run command

====================================
Get the file into the local drive H:\\, but before you get the file intothe local drive
please make sure that you have all the permissions to
manipulate that file else you will see a 0 byte file being ftped to your
local drive.
http://htmlimg2.scribdassets.com/2p1k22iqo02e29ff/images/8-d0cdf92a98.jpg

=========================================
Once you get the file into the H:\\ drive open the file and1. Remove the header of
the file.
2. Then save the file.
3. After that ftp the file into your local directory (using put command)
using the ftp server.4. Then copy the same file into the Informatica source files
location.
5. Run the Informatica workflow

============================
We can perform the other operations to validate the trailer checkand record
count check can be performed by modifying the file and
uploading the file at source location using the FTP commands
======================
Using VI Editor
VI Editor is file editor used in Unix to manipulate the files.

To manipulate the data in the file we must have all the access rights
to the file.

To achieve this first copy the file in your local directory in Unix server by using
the command cp sample.csv /home/local/ .

Once the file is available in the local directory check for thepermissions available
for you on the file.

Change the permissions to RWX by using the chmod command if you don't have
all the access rights.

Open the file with VI editor using command :- VI File name


==============
Remove the header by dd command in VI editor then save the
changes in the file and put the file back into the Informatica source
location and run the workflow

The workflow should fail at the step where header validation is done.

Similarly we can perform other validations by removing the trailer and then
changing the number of records in the file by copying thedata for other two
business requirements
===================================
Validation Results
For The first business requirement that we are validating where thefile is having
two line header the workflow should run successfully
when the file is having two line header

Change the header of the file by inserting some junk values. TheWorkflow should
fail when the header values are changed to some junk data

Remove both the headers and run the workflow it should fail at thestep where
header validation is done.

Remove one of the headers and run the workflow, the workflowshould fail.
These are the few validations that can be performed while validating

the results and making sure the business rules are implementedproperly in the
mapping.
================================

Similarly
for second
validation
where we
have to
check the

trailer recor
ds we can
perform
following
validations.

Remove the
trailer and
run the
workflow,
the
workflow

should fail
at
the step
where trailer
validation is
performed.


Change the
trailer value
to some
junk value
(other then

the
totalnumber
of records),
mapping
should fail

Keep the
correct
trailer
record the
mapping
should Pass

the
trailer check
step.

Insert some
alphanumeri

c values in
the trailer
record, the
mappingsho
uld fail in
this

case.Similar
ly we can
validate
other
business
requirement

s. By
changingthe
file using VI
editor or
using the

FTP
commands

Similarly for second validation where we have to check the trailer records we can
perform following validations.

Remove the trailer and run the workflow, the workflow should fail at
the step where trailer validation is performed.

Change the trailer value to some junk value (other then the totalnumber of
records), mapping should fail

Keep the correct trailer record the mapping should Pass the trailer check step.

Insert some alphanumeric values in the trailer record, the mappingshould fail in
this case.Similarly we can validate other business requirements. By changingthe
file using VI editor or using the FTP commands
===================================
Sample Mapping
This the sample mapping in Informatica for header trailer and countvalidation.

When Header validation fails this step should fail in the mapping

==================================
Informatica steps
And for trailer, max count and Min count validations we havefollowing mappings

===========================================
Informatica View
If workflow succeeds then in workflow monitor following is displayed

Informatica Workflow monitor View


If header check fails in workflow monitor following is displayed

Important points
We can verify which step in Informatica workflow has failed bychecking the same
in the workflow monitor.

All set of business rules for the files to be migrated using Informatica
(or any other tool used for ETL) can be verified following thisapproach.

This approach allows the tester to validate the businessrequirements at the


workflow level.


These validations are specific to the files which are to be migratedusing the ETL
tool before the migration process
Points to remember
There are certain points that must be kept in mind while performingthe
operations on file in Unix.
1.Always keep the backup of the file in your local drive.
2.Always make sure that the file which you are referring to is takenas the input
for the workflow being tested.3.While performing file manipulation in VI editor,
make a copy as
(sample_backup.csv) in your directory.
4. Always keep in mind the target table whether it is truncate or progression
load.
==============
http://www.scribd.com/doc/140567382/Informatica-ETL-Testing-With-UNIX

You might also like