Integrate with HPE ALM Quality Center

Jamo Automator test cases can be easily integrated with HP Quality center.

When adding a test to your Test Plan fill in the required fields and make sure to select the VAPI-XP-TEST type as shown in the screenshot below

Click OK and select VBScript as your script language.

Click finish and open the Test Script tab. In this tab replace all of the generated script with the code snippet found here:

Make sure to replace the parameters defined on top (in the green section) with your credentials, test case and device

' vbtest [VBScript] ' Created by Application Lifecycle Management ' 13/09/2017 12:04:11 ' ====================================================

' ---------------------------------------------------- ' Main Test Function ' Debug - Boolean. Equals to false if running in [Test Mode] : reporting to Application Lifecycle Management ' CurrentTestSet - [OTA COM Library].TestSet. ' CurrentTSTest - [OTA COM Library].TSTest. ' CurrentRun - [OTA COM Library].Run. ' ---------------------------------------------------- Sub Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun) On Error Resume Next ' clear output window TDOutput.Clear 'parameters jamoServerUrl="https://jamo-release.appspot.com" account="{your account}" user="{your username}" myPassword="{your password}" testCaseName="{your test case name}" deviceName="{your device name}"

'if the device name is not unique please use udid instead

deviceUDID="{your udid}"

timeoutInSeconds={how many seconds you should try}

'GET the access token Set loginRestReq = CreateObject("Microsoft.XMLHTTP") loginUrl = jamoServerUrl+"/rest/login?account="+account+"&j_username="+ user +"&j_password="+myPassword loginRestReq.open "POST", loginUrl, false loginRestReq.send If loginRestReq.status <> 200 Then TDOutput.Print "Could not connect to server: please verify if Jamo is up and running" set myStep = CurrentRun.StepFactory.addItem("Connect to Jamo") myStep.Field("ST_DESCRIPTION") = "Could not connect to server: please verify if Jamo Automator is up and running" myStep.Status = "FAILED" myStep.Post CurrentRun.Status = "Failed" CurrentTSTest.Status = "Failed" Else set myStep = CurrentRun.StepFactory.addItem("Connect to Jamo") myStep.Status = "PASSED" myStep.Post afterSuccessLogin=Split(loginRestReq.responseText,"success"":")(1) successfulLogin=Split(afterSuccessLogin,",")(0) If NOT successfulLogin Then TDOutput.Print "Could not login: please verify your credentials" set myStep = CurrentRun.StepFactory.addItem("Login to Jamo") myStep.Field("ST_DESCRIPTION") = "Could not login: please verify your credentials" myStep.Status = "FAILED" myStep.Post CurrentRun.Status = "Failed" CurrentTSTest.Status = "Failed" Else set myStep = CurrentRun.StepFactory.addItem("Login to Jamo") myStep.Status = "PASSED" myStep.Post 'GET accessToken and user key accessToken = loginRestReq.GetResponseHeader("X-AUTH-TOKEN") afterUserKey=Split(loginRestReq.responseText,"userKeyString"":""")(1) userKey=Split(afterUserKey,"""")(0) 'RUN the test case on device Set runReq = CreateObject("Microsoft.XMLHTTP") If IsEmpty(deviceUDID) Then runUrl = jamoServerUrl+"/rest/integration/run?testCase="+testCaseName+"&index=0&device="+deviceName+"&userKey="+userKey Else runUrl = jamoServerUrl+"/rest/integration/run/udid?testCase="+testCaseName+"&index=0&uniqueDeviceIdentification="+deviceUDID+"&userKey="+userKey End If runReq.open "GET", runUrl, false runReq.setRequestHeader "X-AUTH-TOKEN", accessToken runReq.send afterSuccessRun=Split(runReq.responseText,"success"":")(1) successfulRun=Split(afterSuccessRun,",")(0) afterRunMessage=Split(runReq.responseText,"message"":""")(1) runMessage=Split(afterRunMessage,"""")(0) If NOT successfulRun Then TDOutput.Print runMessage set myStep = CurrentRun.StepFactory.addItem("Start to Run test case") myStep.Field("ST_DESCRIPTION") = runMessage myStep.Status = "FAILED" myStep.Post CurrentRun.Status = "Failed" CurrentTSTest.Status = "Failed" Else set myStep = CurrentRun.StepFactory.addItem("Start to Run test case") myStep.Status = "PASSED" myStep.Post waitForReport=true startTime=Now() While (waitForReport AND DateDiff("s",startTime,Now())<timeoutInSeconds) XTools.Sleep 5000 Set reportReq = CreateObject("Microsoft.XMLHTTP") reportUrl = jamoServerUrl+"/rest/integration/report/"+runMessage reportReq.open "GET", reportUrl, false reportReq.setRequestHeader "X-AUTH-TOKEN", accessToken reportReq.send If Len(reportReq.responseText) = 0 Then TDOutput.Print "No report yet" Else afterReportRun=Split(reportReq.responseText,"status"":")(1) reportStatus=Split(afterReportRun,",")(0) TDOutput.Print reportStatus 'We need to wait for a while until the result steps are all there XTools.Sleep 50000 'Get the result steps afterReportRun=Split(reportReq.responseText,"keyString"":""")(1) reportKey=Split(afterReportRun,"""")(0) TDOutput.Print reportKey Set resultsReq = CreateObject("Microsoft.XMLHTTP") resultsUrl = jamoServerUrl+"/rest/integration/resultSteps/"+reportKey resultsReq.open "GET", resultsUrl, false resultsReq.setRequestHeader "X-AUTH-TOKEN", accessToken resultsReq.send TDOutput.Print resultsReq.responseText resultSteps=Split(resultsReq.responseText,"|") For i = 0 to UBound(resultSteps) set myStep = CurrentRun.StepFactory.addItem("Null") myStep.Name=Split(resultSteps(i),";")(1) myStep.Field("ST_DESCRIPTION") = Split(resultSteps(i),";")(2) myStep.Status = Split(resultSteps(i),";")(0) myStep.Post Next waitForReport=false If reportStatus = 2 Then CurrentRun.Status = "Failed" CurrentTSTest.Status = "Failed" End If End If Wend If waitForReport Then TDOutput.Print "Could not find report within time out" CurrentRun.Status = "Failed" CurrentTSTest.Status = "Failed" End If End If End If End If End Sub

That's it: you can now run your test case


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.

ABOUT JAMO

Jamo Solutions provides state-of-the art solutions for UI-based test automation on mobile devices. 'Jamo Automator' is a codeless cloud-based  tool that lets you focus on the test case without the hassle of scripting.

GET IN TOUCH

Houtemstraat 157, 3300 Tienen, Belgium

© 2018 by Jamo Solutions