HPQC DVO Integration - marketplace.informatica.com · Informatica Data Validation option with HPQC...

24
Informatica 9.5.2 Data Validation Option and HPQC Integration using QTP UNUM DOCUMENT AUTHOR: Ashik Jhanun Basha DOCUMENT OWNER: Ashik Jhanun Basha DATE CREATED: Friday, April 25, 2014 LAST UPDATED: Thursday, August 21, 2014 PROJECT: Data Validation Option - ICR COMPANY: UNUM

Transcript of HPQC DVO Integration - marketplace.informatica.com · Informatica Data Validation option with HPQC...

Informatica 9.5.2 Data Validation Option and HPQC Integration using QTP UNUM

DOCUMENT AUTHOR: Ashik Jhanun Basha

DOCUMENT OWNER: Ashik Jhanun Basha

DATE CREATED: Friday, April 25, 2014

LAST UPDATED: Thursday, August 21, 2014

PROJECT: Data Validation Option - ICR

COMPANY: UNUM

Informatica Data Validation Option and HPQC integration using QTP

2 Informatica DVO with HPQC - Ashik

Informatica 9.5.2 Data Validation Option and HPQC Integration using QTP .................................................................. 1 Prerequisites Set-up DVO Tests using Single Test or Table Pair Set-up QTP with HPQC login details Create the HPQC Test Plan using QTP Scripts: Create library files to pass parameters: Test creation in the Test Lab using Test Plan: Attach Bad Records in the QC as Excel Attachment: Trouble shooting: Appendix………………………………………………………………………………………………………………………………………………………………….

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 3

Informatica 9.5.2 Data Validation Option and HPQC

Prerequisites:

The following prerequisites must be met:

The machine must have QTP, QTP Add-ins and HPQC installed.

Data Validation Option has to be installed (this is optional as it is possible to run the HPQC tests for DVO tests residing in other machines).

Set-up DVO Tests using Single Test or Table Pair:

Table pair/Single test has to be created in DVO. Sample screenshot for reference below:

DVO Schema has to be selected in the Table pair/Single table test to write the bad records in the database. Reference screenshot follows:

Informatica Data Validation Option and HPQC integration using QTP

4 Informatica DVO with HPQC - Ashik

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 5

External Id values have to be entered in the Table pair/Single test and make this value as unique for all the tests. This External Id will be used as a test name in the HPQC.

Set-up QTP with HPQC login details:

Run QTP as an Administrator for once. (Have to run as administrator for the first time ) In QTP, File -> Quality center connection. Quality Center location: Use http://qualitycenter:8080/qcbin (It could be different for your HPQC) to use login. Use user id and password.

Informatica Data Validation Option and HPQC integration using QTP

6 Informatica DVO with HPQC - Ashik

Close the QTP.

Create the HPQC Test Plan using QTP Scripts:

Open the QTP, Create a new test (using the script which is attached). File -> New -> Test Paste the attached “QTP_Script.txt” script in the test.

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 7

HPQC Sample Script: 'Assign variables strTestScriptName = Trim(Environment.Value("TestName")) datetoday = Now strMonth = Month(datetoday) strDay = Day(datetoday) strHour = Hour(datetoday) strMinute = Minute(datetoday) strSecond = Second(datetoday) daytoday = strMonth & "_" & strDay & "_" & YEAR(datetoday) & "_" timetoday = strHour & "h-" & strMinute & "m" 'HPQC Folder set up AUTOTEST_FOLDER = "Root\GLOBAL SERVICES\To be Deleted\Test_delete\" Set QCConnection = QCUtil.QCConnection 'Use Local folder path as a temporary path to save the file localFolderPath ="C:\Users\" & QCConnection.username & "\" & strTestScriptName & ".xlsx" strRename="C:\Users\" & QCConnection.username & "\" & strTestScriptName &"_" & daytoday & timetoday & ".xlsx" ' Create connection Objects Set objDB2ConnAdCn = CreateObject("ADODB.Connection") Set objDB2RecordSet =CreateObject("adodb.recordset") Set objDB2RecordSet1 =CreateObject("adodb.recordset") Set objDB2RecordSet2 =CreateObject("adodb.recordset") 'Query the database to get the passed or Failed status objDB2ConnAdCn.open "Driver={IBM DB2 ODBC DRIVER};Database=" & strDataBaseName & ";Hostname=" & strServerName & ";Port=" & strPortNo & "; Protocol=TCPIP;Uid=" & strUserName & ";Pwd=" & strPassword & ";" objDB2RecordSet1.open "SELECT min(int(tc_rs_result)),TC_DESCRIPTION, decode(TC_RS_RESULT,1,'PASS','FAIL') FROM PCDVO1.RESULTS_SUMMARY_VIEW WHERE tr_is_latest = 1 AND

Informatica Data Validation Option and HPQC integration using QTP

8 Informatica DVO with HPQC - Ashik

tp_external_id= (select '" & strTestScriptName & "' from SYSIBM.SYSDUMMY1) group by TC_DESCRIPTION, TC_RS_RESULT",objDB2ConnAdCn objDB2RecordSet1.MoveFirst Do until objDB2RecordSet1.EOF strActualValue = Trim(objDB2RecordSet1.Fields(0).Value) strdesc = Trim(objDB2RecordSet1.Fields(1).Value) strValue = Trim(objDB2RecordSet1.Fields(2).Value) strValue1 = Trim(objDB2RecordSet1.Fields(2).Value) If (strActualValue) = 1 Then 'Report the details in the Test Instances Reporter.ReportEvent micPass, strTestScriptName," Passed Test --> '" & strdesc & "'" Else Reporter.ReportEvent micFail, strTestScriptName, " Failed Test --> '" & strdesc & "'" End If objDB2RecordSet1.MoveNext LOOP Set objDB2RecordSet1 = Nothing row_count= 1 'Get the failed counts objDB2RecordSet2.open "select min(int(rsv.tc_rs_result)),rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b from PCDVO1.results_summary_view rsv,PCDVO1.RS_BAD_RECORDS_VIEW rbv where rsv.tr_is_latest = 1 AND rsv.tp_external_id= (select '" & strTestScriptName & "' from SYSIBM.SYSDUMMY1) and rsv.tr_id = rbv.tr_id and rsv.tc_index= rbv.tc_index group by rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b",objDB2ConnAdCn Do until objDB2RecordSet2.EOF row_count= row_count +1 objDB2RecordSet2.MoveNext LOOP Set objDB2RecordSet2 = Nothing

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 9

If row_count>1 Then ' Get the bad records from the database objDB2RecordSet.open "select min(int(rsv.tc_rs_result)),rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b from PCDVO1.results_summary_view rsv,PCDVO1.RS_BAD_RECORDS_VIEW rbv where rsv.tr_is_latest = 1 AND rsv.tp_external_id= (select '" & strTestScriptName & "' from SYSIBM.SYSDUMMY1) and rsv.tr_id = rbv.tr_id and rsv.tc_index= rbv.tc_index group by rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b",objDB2ConnAdCn ' Use Excel as an attachment in QC Set ObjExcel=CreateObject("Excel.Application") ObjExcel.Application.Visible=False ObjExcel.Workbooks.Add wait 2 ObjExcel.ActiveWorkbook.SaveAs localFolderPath Set ObjWorkbook=ObjExcel.Workbooks.Open(localFolderPath) Set ObjSheet=ObjWorkbook.Worksheets("Sheet1") 'Excel sheet column headers and colors objsheet.cells(1,1).value ="DESCRIPTION" objsheet.cells(1,1).Interior.ColorIndex = 15 objsheet.cells(1,1).Font.bold= True objsheet.cells(1,2).value ="Join Key" objsheet.cells(1,2).Font.bold= True objsheet.cells(1,2).Interior.ColorIndex = 15 objsheet.cells(1,3).value ="Source_Key" objsheet.cells(1,3).Font.bold= True objsheet.cells(1,3).Interior.ColorIndex = 15 objsheet.cells(1,4).value = "SOURCE_COLUMN" objsheet.cells(1,4).Font.bold= True objsheet.cells(1,4).Interior.ColorIndex = 15 objsheet.cells(1,5).value = "SOURCE_VALUE" objsheet.cells(1,5).Font.bold= True objsheet.cells(1,5).Interior.ColorIndex = 15

Informatica Data Validation Option and HPQC integration using QTP

10 Informatica DVO with HPQC - Ashik

objsheet.cells(1,6).value = "TARGET_VALUE" objsheet.cells(1,6).Font.bold= True objsheet.cells(1,6).Interior.ColorIndex = 15 objsheet.cells(1,7).value = "TARGET_COLUMN" objsheet.cells(1,7).Font.bold= True objsheet.cells(1,7).Interior.ColorIndex = 15 objsheet.cells(1,8).value ="Target_Key" objsheet.cells(1,8).Font.bold= True objsheet.cells(1,8).Interior.ColorIndex = 15 username= QCConnection.UserName rowcount =objDB2RecordSet.RecordCount colcount=objDB2RecordSet.fields.count objDB2RecordSet.MoveFirst ' Save the bad records in the excel For j=2 to row_count For i=1 TO colcount-1 ObjSheet.cells (j,i).value= Trim(objDB2RecordSet.Fields(i)) Next ObjExcel.DisplayAlerts = False objDB2RecordSet.MoveNext Next ObjWorkbook.Save wait(1) ObjWorkbook.Close ObjExcel.Quit ObjExcel.Application.Quit Set ObjExcel = Nothing 'Call the function

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 11

CALL UploadFilesToQC End If Set ObjSheet = Nothing Set objFS = Nothing Set ObjExcel = Nothing Set objDB2ConnAdCn = Nothing Set objDB2RecordSet = Nothing 'Function to upload the attachment in the QC Public Function UploadFilesToQC fileCount = 0 Set QCConnection = QCUtil.QCConnection set oAttachment = QCUtil.CurrentTestsetTest.Attachments Set fso = CreateObject("Scripting.FileSystemObject") If FSO.FileExists( localFolderPath) Then FSO.MoveFile localFolderPath, strRename End If

Set attach = oAttachment.AddItem(Null) attach.FileName = strRename attach.Type = 1 attach.Post Set attach = nothing set oAttachment = nothing Set AFolder = nothing Set node = nothing Set treeManager= nothing 'Delete the excel from the local folder path

Informatica Data Validation Option and HPQC integration using QTP

12 Informatica DVO with HPQC - Ashik

fso.DeleteFile strRename Set QCConnection= nothing End Function Sql Queries: (Below Sql queries can be used to have 1 hpqc test for one folder test in DVO).

1) SELECT min(int(tc_rs_result)),TC_DESCRIPTION, decode(TC_RS_RESULT,1,'PASS','FAIL') FROM

PCDVO1.RESULTS_SUMMARY_VIEW WHERE tr_is_latest = 1 AND tp_folder_name= ‘Folder name' group by

TC_DESCRIPTION, TC_RS_RESULT

2) select

min(int(rsv.tc_rs_result)),rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_v

alue_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b, rsv.tp_external_id from

PCDVO1.results_summary_view rsv,PCDVO1.RS_BAD_RECORDS_VIEW rbv where rsv.tr_is_latest = 1 AND

rsv.tp_folder_name= ‘Folder name' and rsv.tr_id = rbv.tr_id and rsv.tc_index= rbv.tc_index group by

rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a,

rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b,rsv.tp_external_id

3) select

min(int(rsv.tc_rs_result)),rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_v

alue_a, rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b, rsv.tp_external_id from

PCDVO1.results_summary_view rsv,PCDVO1.RS_BAD_RECORDS_VIEW rbv where rsv.tr_is_latest = 1 AND

rsv.tp_folder_name= 'Folder name’ and rsv.tr_id = rbv.tr_id and rsv.tc_index= rbv.tc_index group by

rsv.TC_DESCRIPTION,rsv.tp_join_list_str,rbv.tc_rs_br_key_a,rsv.tc_column_a,rbv.tc_rs_br_value_a,

rbv.tc_rs_br_value_b,rsv.tc_column_b,rbv.tc_rs_br_key_b,rsv.tp_external_id

Click on the expert view in the bottom to see the script (Default is keyword view) Save the test with same name as the DVO Table pair external id EG: VRS (Virginia Retirement system) In the same location as where the Test plans are created in HPQC. QTP saving location for now (It should be the same as the location where HPQC Test Plan are being created)

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 13

Note: No need to create any test plan separately once this test script is saved in Test Plan. This can be used as a Test plan and update all the details and attributes manually to track it in the HPQC. HPQC Location Sample screenshot:

Informatica Data Validation Option and HPQC integration using QTP

14 Informatica DVO with HPQC - Ashik

Create library files to pass parameters:

Library file Set-up to pass parameters like database details, locations and other Global variables. In QTP, Click on File - > New -> Function Library. Create the library file with the all the details as shown in “Library.txt”. Library file code: strServerName = " " --- mention the server name in here strUserName = "PCDVO1" --- Database User name strPassword = "xxxxxxxx" --- Database Password strDataBaseName = "INFA03I" --- Database name strPortNo = 60125 --- Port number Add library file as resource to the QTP script.

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 15

In QTP, Click on File -> Settings. The below window can be viewed.

Now click on Resources, Click on + symbol to add function library. Select the below library file to add the library to the script.

Informatica Data Validation Option and HPQC integration using QTP

16 Informatica DVO with HPQC - Ashik

Click on “apply” and “ok” to get the library added.

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 17

Click on save and close the QTP.

Test creation in the Test Lab using Test Plan:

Open HPQC and Click on Test lab. Location: GLOBAL SERVICES/To be Deleted/Test_QTP

Informatica Data Validation Option and HPQC integration using QTP

18 Informatica DVO with HPQC - Ashik

Right Click on the folder and select New Test Set

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 19

Enter the test name (It could be any name related to the test sets)

Informatica Data Validation Option and HPQC integration using QTP

20 Informatica DVO with HPQC - Ashik

Click on Select tests and choose the Test plan (Test script which was created through QTP) from the Test plan tree (right side) by double clicking the test plan.

Click on RUN

Another window will pop-up with the run information like below. Click on Run All test locally and Enable log. Click on Run to execute the test.

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 21

Test run Failed

Close this window and Right click on the test and select Test Instance Properties.

Informatica Data Validation Option and HPQC integration using QTP

22 Informatica DVO with HPQC - Ashik

All the test run related information will pop-up like below.

Informatica Data Validation option with HPQC Integration using QTP

Informatica DVO with HPQC - Ashik 23

Attach Bad Records in the QC as Excel Attachment:

All the bad records would be attached as an excel sheet for that test after execution. This will not have Count Mismatch as count mismatch are not being stored in the bad records table.

Informatica Data Validation Option and HPQC integration using QTP

24 Informatica DVO with HPQC - Ashik

Trouble shooting:

1) When test is stopped manually for any reason, below steps has to be taken place.

a) Go to task manager, under the processes end the EXCEL.EXE process.

b) Also when you run next time, it will ask you to replace a file as the file already present in local folder.

It can be either deleted or just click on replace whenever test is being executed.

2) There will be a scenario when the bad records and DVO results will be different.

Reason: We are using external id as unique id for the tests. In case the tester modified the Table pair name and did

not modify the external id then the same external id will have both old and new table pair records in the database

which will be a mismatch. Modifying the external id and rerunning in DVO will resolve this issue.