question

mallikarjunarao avatar image
mallikarjunarao asked ericnute edited

publish test report using itestcli

How do i publish test report using itestcli command with out executing testcase? I already executed testcase with different versions. This testcase attached multiple test instances in HP ALM, so I have to done this by using itestcli command. Is this possible using itestcli command form Win 7 OS.
iTestitestcliHP QC ALM
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gskumar avatar image
gskumar answered ericnute edited
I think attachment is not working. Check below code Dim TSetFact, tsList Dim theTestSet Dim tsTreeMgr Dim tsFolder Dim Scheduler Dim execStatus Dim tdc Dim nPath Dim TSTestFact, testList Dim tsFilter Dim TSTst Dim QCinfo Dim QtpTestCaseInfo Dim CdRouterTestCaseInfo Dim CdRouterTestResult Dim QcTestResult Dim App '########################### 'Get args from command line If WScript.Arguments.Count < 7 Then WScript.Echo "Usage: Command " WScript.Quit End If test_case_path = WScript.Arguments(6) Set QCinfo=CreateObject("Scripting.Dictionary") QCinfo.Add "qcurl",WScript.Arguments(0) QCinfo.Add "username", WScript.Arguments(1) QCinfo.Add "password",WScript.Arguments(2) QCinfo.Add "domain", WScript.Arguments(3) QCinfo.Add "project", WScript.Arguments(4) QCinfo.Add "version",WScript.Arguments(5) ' read the test case name from file if Not read_test_case_from_file(test_case_path) then wscript.echo "fail to open test case file "&test_case_path Wscript.quit end if ' connect to qc 'DisableLocalAdapter("eth0") if connect_to_qc then wscript.echo "ConnectSuccess" if set_result then wscript.echo "set tester success" else wscript.echo "set tester failed" end if clearup Wscript.quit else wscript.echo "ConnectFailed" Wscript.quit end if Function read_test_case_from_file(file_name_path) read_test_case_from_file=False Set QcTestResult=CreateObject("Scripting.Dictionary") Set fso = CreateObject ("Scripting.FileSystemObject") if fso.FileExists(file_name_path) then Set fs = fso.OpenTextFile (file_name_path,1) else wscript.echo "open file fail" Exit Function end if Do While Not fs.AtEndOfStream Temp_Result=split(fs.ReadLine,"==") QcTestResult.add Temp_Result(0), Temp_Result(1) Loop fs.Close Set file = Nothing Set fso = Nothing read_test_case_from_file=True end function Function connect_to_qc() connect_to_qc=False ' init the lib Set tdc = CreateObject("TDAPIOLE80.TDConnection") If (tdc Is Nothing) Then wscript.echo "init qc failed" Exit Function Else wscript.echo "init qc success" End If ' connect to qc and project On Error Resume Next tdc.InitConnectionEx qcInfo("qcurl") tdc.Login qcInfo("username"), qcInfo("password") tdc.Connect qcInfo("domain"), qcInfo("project") On Error GoTo 0 If Err.Number>0 Then wscript.echo "connect to qc failed" clearup Exit Function End If ' connect to test set On Error Resume Next Set TSetFact = tdc.TestSetFactory Set tsTreeMgr = tdc.TestSetTreeManager nPath = "Root\" & Trim(qcInfo("version")) spbuQcDebugLog " spbu-router-upgrade.vbs", "rconnectQC", nPath Set tsFolder = tsTreeMgr.NodeByPath(nPath) If (tsFolder Is Nothing) Then wscript.echo "connect to test set failed" Exit Function Else wscript.echo "connect to test set success" End If On Error GoTo 0 If Err.Number>0 Then wscript.echo "connect to test set failed" clearup Exit Function End If connect_to_qc=True End Function Function set_result() changeFlag=0 set_result=false Set resultFlag=CreateObject("Scripting.Dictionary") resultFlag.add "Pass", "Passed" resultFlag.add "Fail", "Failed" resultFlag.add "Abort", "Failed" resultFlag.add "failed", "Failed" resultFlag.add "n/s", "Blocked" resultFlag.add "skip", "N/A" resultFlag.add vbNullString, "Failed" If QcTestResult Is Nothing Or (Not IsObject(QcTestResult)) Then wscript.echo "fail: result not found" Exit Function End If If QcTestResult.count=0 Then wscript.echo "fail: result not found" Exit Function End If On Error Resume next qcCases=QcTestResult.keys For j=0 To QcTestResult.count-1 qcCase=qcCases(j) qcIn=Split(qcCase,"::") Set tsList = tsFolder.FindTestSets(qcIn(0)) If tsList.Count > 0 Then spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "find "&tsList.Count&" test set" ElseIf tsList.Count < 1 Then spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "can't find the test set" End If Set theTestSet = tsList.Item(1) Set TSTestFact = theTestSet.TSTestFactory Set tsFilter = TSTestFact.Filter tsFilter.Filter("TC_CYCLE_ID") = theTestSet.ID Set testList = TSTestFact.NewList(tsFilter.Text) For Each TSTst In testList 'spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "ddd: " & TSTst.Name 'spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "Name in dic: " &qcIn(1) If InStr(TSTst.name,qcIn(1))>0 Then spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "Name: " & TSTst.Name & " result in dic: " &QcTestResult(qcCase) &"result in flag" &resultFlag(QcTestResult(qcCase)) TSTst.Status = resultFlag(QcTestResult(qcCase)) TSTst.Field("TC_TESTER_NAME") = qcInfo("username") TSTst.Post If TsTst.Status <> resultFlag(QcTestResult(qcCase)) Then spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "Name: " & TSTst.Name & " ID: " & TSTst.ID &"Status:" &TSTst.Status Else changeFlag=changeFlag+1 End If End If Next Next On Error GoTo 0 If Err.Number>0 Then wscript.echo "set result failed" Exit Function End If spbuQcDebugLog " spbu-router-upgrade.vbs", "WriteResultToQC", "Total cases " & QcTestResult.count & " change cases: " & changeFlag wscript.echo "Finish to export the result\n Total Export Case: "& changeFlag set_result=true End Function Function clearup() tdc.Logout Set testList = Nothing Set tsFilter = Nothing Set theTestSet = Nothing Set tsFolder = Nothing Set tsTreeMgr = Nothing Set TSetFact = Nothing Set tdc = Nothing Set QCinfo= Nothing Set QtpTestCaseInfo= Nothing Set CdRouterTestCaseInfo= Nothing Set CdRouterTestResult= Nothing Set QcTestResult= Nothing 'enableLocalAdapter("eth0") End Function '### '# Function Name: spbuQcDebugLog '# '# Description : the log function '# Arguments : '# '# '# Return Value : NONE Sub spbuQcDebugLog(filename, subname, msg) If IsEmpty(Runtime_strSessionDebugLog )Then strFilename=Wscript.scriptFullName Pos=InStrRev(strFilename,"\") Runtime_strSessionDebugLog=Left(strFilename,Pos)+"QC.Log" End If Call logToFile(Runtime_strSessionDebugLog, filename, subname, msg) End Sub Sub logToFile(filename, libfilename, subname, msg) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(filename, 8, True) strLog = "" If libfilename <> "" Or subname <> "" Or msg <> "" Then strLog = FormatDateTime(Now,2) & " " & FormatDateTime(Now,3) & ": " End If If libfilename <> "" Then strLog = strLog & libfilename & ", " End If If subname <> "" Then strLog = strLog & subname & ", " End If f.WriteLine strLog & msg & vbCrlf f.Close End Sub
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mallikarjunarao avatar image mallikarjunarao commented ·
Or could you email to this attachment? My email malli.kv2@gmail.com, and execution procedure. Thanks Malli
0 Likes 0 ·
gskumar avatar image
gskumar answered mallikarjunarao commented
Hi Mallikarjun, PFA script to upload the results to QC.
2 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mallikarjunarao avatar image mallikarjunarao commented ·
I did not attachments, could you share again?
0 Likes 0 ·
gskumar avatar image gskumar commented ·
check now
0 Likes 0 ·
madhuri avatar image
madhuri answered ericnute edited
Could you please try the below command: ![itestcli example command][1] [1]: /storage/temp/3781-itestcli.png

itestcli.png (5.9 KiB)
3 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gskumar avatar image gskumar commented ·
hi madhuri, what if we wanted upload 100+ testresults at a time..? do we need to execute this step 100 times or we need to create a for loop for it..
0 Likes 0 ·
mallikarjunarao avatar image mallikarjunarao commented ·
I already executed testcase, i have report in my location, but my concern i need to publish testcase report in quality center using iTestcli| iTestrt tool. Since my test instance not mapped to perticuler location, i need manually map the test instance to different location.
0 Likes 0 ·
mallikarjunarao avatar image mallikarjunarao commented ·
Yes, Santosh you could use loop to execute and publish testcase report to HP ALM eval exec [auto_execok myitest] "\{--refreshWorkspace --publishToQualityCenter --qcServer "$qcServer" --qcUser $qcUser --qcPassword $qcPassword --qcDomain $qcDomain --qcProject "$qcProject" --qcTestInstance "$qcTempTestInstacePath" --workspace "$workspace" -p $concatQcParams "$testcaseURL"\}" #set status [catch {exec $itestCliCmd} result]
0 Likes 0 ·
gskumar avatar image
gskumar answered mallikarjunarao commented
I don't know about iTest cli process, recently i heard that iTest RT can do this and also we can export our testresult by using VBScript. we can control the QC from VBScript ex: TDConnect. try this. - Santosh
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mallikarjunarao avatar image mallikarjunarao commented ·
Santosh, how you are doing with vb script could share more information on vb script.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.