|
Public Function InitFunc()
If is_fileexists(Local_Path & "debu.txt") or is_fileexists(Local_Path & "debu.txt.bak") Then
reporter.ReportEvent micFail, "error", "met error, exiting test, please re-run it."
ExitTest
End If
''''''''''''''''''''''Modify And''''''''''''''''''''''''''''''''
'Initinal the general configure of the project.
'If connected with QC, download the DataTable from QC, else the DataTable is in the local.
On Error Resume Next
sTemp=QCUtil.CurrentTestSet.Name
If err.number Then
CheckQCConnect2
Err.Clear
Else
CheckQCConnect
End if
On error goto 0
Dim ExcelObj
Dim fso
Dim rc
Dim qtApp
' Set qtApp = CreateObject("QuickTest.Application")
' qtApp.Test.Settings.Run.IterationMode = "oneIteration"
' Set qtApp = Nothing
SYC_TWO=2
SYC_ONE=1
SYC_FIVE=5
SYC_TEN=10
SYC_TWENTY=20
Total_Pass_Count=0
Total_Fail_Count=0
POPUP_WINDOW_TIME=20
DEFAULT_TIMEOUT=Setting("DefaultTimeout")
Setting("DefaultTimeout") =TIMEOUT_WAITPROPERTY
RUNNING_TEST_NAME=Environment("TestName")
TS_TEST_ID = ""
' JpgPath=Environment("TestDir") & "\scr"
JpgPath="C:\Temp\scr"
DATA_TABLE=""
''''''''''''''''If Data Table in QC Test Plan , use this.'''''''''''''''''''''
' If QCUtil.IsConnected Then
' Is_Local_Run=0
' TS_TEST_ID = QCUtil.CurrentTest.ID
' Set CurrentTS=QCUtil.CurrentTestSet
' CURRENT_TESTSET=UCase(Trim(CurrentTS.Name))
' Local_Path=GetAttachmentLocalPathFromTest(TS_TEST_ID,RUNNING_TEST_NAME & ".xls")
' DATA_TABLE=DownloadAttachmentFromTest (TS_TEST_ID,RUNNING_TEST_NAME & ".xls",Local_Path)
' Data_Table=QCGetDataTable(sDataTablePath, Environment("TestName"))
' Else
' Is_Local_Run=1
' DATA_TABLE = Environment("TestDir") & "\" & RUNNING_TEST_NAME & ".xls"
' End If
' Modify By Harris Mar 14
' If Trim(DATA_TABLE) = "" Then
' Report_Msg "", micFailed, "Cannot import the DataTable"
' ExitTest
' End If
''''''''''''''''If Data Table in QC Test Plan , use this.'''''''''''''''''''''
If QCUtil.IsConnected then
Set qcConn = QCUtil.QCConnection
Select Case trim(qcConn.ProjectName)
case "AP_BAURelease_UAT_11a"
DOMAIN = "https://eclipseuat-card.appc.citicorp.com/siteminderagent/forms/login.html"
case "AP_BAURelease_SIT_11a"
DOMAIN = "https://eclipsesit-bank.appc.citicorp.com:5000/siteminderagent/forms/login.html"
case "AP_RainbowNA_Bank_SIT"
DOMAIN = "https://sit1.northasia.customer360view.aspac.citigroup.net:8443/siteminderagent/forms/login.html"
' Case "GCTT_Regression"
' DOMAIN="https://sit.customer360view.aspac.citigroup.net:8443/wps/myportal"
case "GlobalCommon_SIT"
DOMAIN = "https://sit1.globalcommon360view.consumer.citigroup.net:5001"
End Select
Is_Local_Run=0
On Error Resume Next
TS_TEST_ID = QCUtil.CurrentTest.ID
If err.number Then
Set tdc = qcutil.QCConnection
Set tFact = tdc.TestFactory
Set TestFilter = tFact.Filter
TestFilter.Filter("TS_NAME") = chr(34) & RUNNING_TEST_NAME & chr(34)
TestFilter.Filter("TS_TYPE") = "QUICKTEST_TEST"
TestFilter.Filter("TS_SUBJECT") = SubjectPath
Set testList = tFact.NewList(TestFilter.Text)
If testList.Count = 1 Then
TS_TEST_ID = testList.item(1).Field("TS_TEST_ID")
Else
print "the TEST_ID is more than one. please check it."
End If
Set TreeManager = tdc.TestSetTreeManager
Set tsFolder = TreeManager.NodeByPath(Lab_Path_DataPrerare)
Set lst = tsFolder.FindTestInstances(RUNNING_TEST_NAME, True, "")
For i = 1 To lst.Count
Set instance = lst.Item(i)
If Instr(1,UCase(instance.TestSet.Name),UCase(sCountry)) > 0 And CLng(instance.TestID) = TS_TEST_ID Then
CURRENT_TESTSET = UCase(instance.TestSet.Name)
Set runFact = instance.RunFactory
Set theRun = runFact.AddItem("Local Run")
theRun("RN_TESTER_NAME") = tdc.UserName
Exit For
End If
Next
Set TestFilter = nothing
Set tdc = nothing
Set tFact = nothing
Err.Clear
Else
TS_TEST_ID = QCUtil.CurrentTest.ID
Set CurrentTS=QCUtil.CurrentTestSet
CURRENT_TESTSET=ucase(trim(CurrentTS.Name))
End If
On error goto 0
Set obj_data=createobject("vb_html_report.clsreport")
obj_data.SHHK_mkdir(Local_Path)
DataPathonQC = "[QualityCenter\Resources] Resources\Automation\ECS\AutoTest_Card\Regression 2012\Data Table\"
If Instr(1,UCase(CURRENT_TESTSET),"BVT") > 0 Then
DataPathonQC = DataPathonQC & "\BVT\"
End If
DATA_TABLE_ID = GetFoldID(DataPathonQC)
DownloadResource DATA_TABLE_ID, RUNNING_TEST_NAME & ".xls", Local_Path '''Please don't comment block.
DATA_TABLE= Local_Path & RUNNING_TEST_NAME & ".xls"
Else
Is_Local_Run=1
DATA_TABLE = Local_Path & RUNNING_TEST_NAME & ".xls"
DOMAIN = "https://eclipsesit-bank.appc.citicorp.com:5000/siteminderagent/forms/login.html"
End if
Set obj_data=CreateObject("vb_html_report.clsreport")
Set obj_bmp2jpg=CreateObject("vb_bmp2jpg.clsbmp2jpg")
Set fso = CreateObject("Scripting.FileSystemObject")
Set ExcelObj = CreateObject("Excel.Application")
If obj_data.SHHK_folderorfile_exist(jpgpath)=0 Then
obj_data.SHHK_mkdir(jpgpath)
End If
suffix_num=0
ExcelObj.Workbooks.Add
html_file="C:\Temp\"&RUNNING_TEST_NAME&"_result"&suffix_num&".xls"
Do while fso.FileExists(html_file)
suffix_num=suffix_num+1
html_file="C:\Temp\"&RUNNING_TEST_NAME&"_result"&suffix_num&".xls"
Loop
ExcelObj.ActiveWorkbook.Worksheets("sheet1").Range("A:IV").Interior.ColorIndex = 2
' ExcelObj.ActiveWorkbook.SaveAs html_file
Const xlWorkbookNormal = -4143
ExcelObj.ActiveWorkbook.SaveAs html_file,xlWorkbookNormal
ExcelObj.Quit
img_name=1
''''''''''''''''''''''@Harris 11/16 Modify Begin''''''''''''''''''''''''''''''''
Set fso=Nothing
''''''''''''''''''''''Modify And'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Function |
|