code for QTP and ALM
'==========================================================================
' Name: connectALM
' Summary: connect to ALM
' Parameters:
' QCServer,QCUserName, QCPassword, QCDomain, QCProject: QC and user information
' Outputs:
' True or False
'==========================================================================
Function connectALM(QCServer,QCUserName, QCPassword, QCDomain, QCProject)
Set TDConnection = CreateObject("TDApiOle80.TDConnection")
With TDConnection
'Create a connection with the QC Server
.InitConnectionEx QCServer
'Login to QC
.Login QCUserName, QCPassword
'Connect to QC Project
.Connect QCDomain, QCProject
End With
If not isnull(TDConnection) Then
Reporter.ReportEvent micPass,"Connect to ALM", "Connected successfully."
connectALM = True
Else
Reporter.ReportEvent micFail,"Connect to ALM", "Connected failed."
connectALM = null
End If
End Function
'==========================================================================
' Name: disconnectALM
' Summary: disconnect ALM, release object
' Parameters:
' TDConnection:the object connecting ALM
' Outputs: none
'==========================================================================
Function disconnectALM(TDConnection)
TDConnection.DisconnectProject
TDConnection.ReleaseConnection
Set TDConnection = Nothing
End Function
'==========================================================================
' Name: checkTestSet
' Summary: check test set exist or not
' Parameters:
' TDConnection:the object connecting ALM
' QCTestSetPath, QCTestSetName: test set information
' Outputs:
' True or False
'==========================================================================
Function checkTestSet(TDConnection,QCTestSetPath, QCTestSetName)
Set TSTreeManager = TDConnection.TestSetTreeManager
'Return the test set tree node from the specified tree path
Set TSFolder = TSTreeManager.NodeByPath(QCTestSetPath)
'Returns the list of test sets contained in the folder that match the specified pattern.
Set TSList = TSFolder.FindTestSets(QCTestSetName)
If TSList.Count = 0 Then
Reporter.ReportEvent micFail,"Mark status in ALM", "No TestSet in the."& QCTestSetPath
checkTestSet = False
Else
isFound = False
For Each TestSet in TSList
If LCase(TestSet.Name) = LCase(QCTestSetName) Then
isFound = True
checkTestSet = True
Exit For
End If
Next
'if QCTestSetName was not found then exit.
If not isFound Then
Reporter.ReportEvent micFail,"Mark status in ALM", "TestSet "& QCTestSetName & " was not found."
checkTestSet = False
End If
End If
End Function
'==========================================================================
' Name: markCaseStatusonALM
' Summary: according to array of case name, mark corresponding status in the ALM
' Parameters:
' TDConnection:the object connecting ALM
' QCTestSetPath, QCTestSetName: test set information
' Outputs: none
'==========================================================================
Function markCaseStatusonALM(TDConnection,QCTestSetPath, QCTestSetName, arrCaseName, arrCaseStatus)
blnExist = checkTestSet(TDConnection,QCTestSetPath, QCTestSetName)
Set TSTreeManager = TDConnection.TestSetTreeManager
If blnExist Then
'This enables database to update immediately when the field value changes
TestSet.AutoPost = True
'TSTestFactory manages test instances (TSTest objects) in a test set
Set TSTestFactory = TestSet.TSTestFactory
'TSTestFactory.NewList("") creates a list of objects according to the specified filter
For Each qtTest in TSTestFactory.NewList("")
'Change test status to N/A
'We do this to ensure all tests have 'not run' before starting execution
'If the execution errors out, we can keep track of the tests that were not run
qtTest.Field("TC_STATUS") = "N/A"
qtTest.Post
Next
'mark status according to input array
intCaseNumber = Ubound(arrCaseName)
'Get each case from array and find the test name from ALM
For i = 0 To intCaseNumber
For Each qtTest in TSTestFactory.NewList("")
strNameinALM = trim(qtTest.name)
'Remove [x] from test name
strNameinALM = mid(strNameinALM,4)
If Lcase(trim(strNameinALM)) = Lcase(trim(arrCaseName(i))) Then
qtTest.Field("TC_STATUS") = arrCaseStatus(i)
qtTest.Post
Exit For
End If
Next
Next
End If
End Function
'==========================================================================
' Name: addAttachmentOnQC
' Summary: according to array of case name, mark corresponding status in the ALM
' Parameters:
' TDConnection:the object connecting ALM
' QCTestSetPath, QCTestSetName: test set information
' arrOutputXMLFilePath, arrInputXMLFilePath, arrCaseName: array stored case and requst/response xml file name
' Outputs: none
'==========================================================================
Function addAttachmentOnQC(TDConnection, QCTestSetPath, QCTestSetName, arrOutputXMLFilePath, arrInputXMLFilePath, arrCaseName)
blnExist = checkTestSet(TDConnection,QCTestSetPath, QCTestSetName)
Set TSTreeManager = TDConnection.TestSetTreeManager
If blnExist Then
'This enables database to update immediately when the field value changes
TestSet.AutoPost = True
'TSTestFactory manages test instances (TSTest objects) in a test set
Set TSTestFactory = TestSet.TSTestFactory
AddAttachmentOnQC = False
intCaseNumber = Ubound(arrCaseName)
Set fso = createobject("scripting.filesystemobject")
'Get each case from array and find the test name from ALM
For i = 0 To intCaseNumber
For Each qtTest in TSTestFactory.NewList("")
strNameinALM = trim(qtTest.name)
'Remove [x] from test name
strNameinALM = mid(strNameinALM,4)
If Lcase(trim(strNameinALM)) = Lcase(trim(arrCaseName(i))) Then
strOutputXMLFilePath = Environment("TestDir")&"\OutputXML\"&arrOutputXMLFilePath(i)
strInputXMLFilePath = Environment("TestDir")&"\InputXML\"&arrInputXMLFilePath(i)
Set AttachmentFactory = qtTest.Attachments
Set Attachment = AttachmentFactory.AddItem(Null)
If fso.FileExists(strOutputXMLFilePath) Then
Attachment.FileName = strOutputXMLFilePath
Attachment.Type = 1
Attachment.Post
End If
If fso.FileExists(strInputXMLFilePath) Then
Attachment.FileName = strInputXMLFilePath
Attachment.Type = 1
Attachment.Post
End If
Attachment.Refresh
Exit For
End If
Next
Next
End if
End Function
code for QTP and ALM的更多相关文章
- QTP Test ,VAPI-XP Test,LR Test 和ALM 集成远程分布式执行遇到的“access is denied ” “unspecified error”问题
大家都知道QTP与ALM (QC的升级版)集成是最好的一个分布式执行的结合.因为毕竟QTP是一个商业软件,HP当然不会让你去跟其他的open source的工具去集成,要不他到哪里去挣钱. 有时候服务 ...
- Test Android with QTP
by Yaron Assa I have recently come across a plug-in to QTP that enables to automate tests on Android ...
- QTP Code Segment
Dim WshShellset WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "{DOWN}&quo ...
- 自动化测试工具QTP和SilkTest横向PK(转)
转自:http://www.uml.org.cn/Test/201405212.asp?artid=1686 众所周知,自动化测试工具曾几何时三足鼎立,Mercury QTP/WinRunner系.I ...
- QTP 场景恢复– 函数调用
创建自动化测试是为了实现无人值守下运行,但也给开发人员带来一些问题.假如你离开办公室前启动测试,想要让它通宵运行.然而,由于不可预见的错误,您的测试会在某一点停止,中断了测试结果.因此QTP中引入场景 ...
- ALM/QC OTA Field in Database(查询ALM数据库的字段)
在使用ALM的OTA接口编写脚本的时候,通常会需要知道各个选项在数据库中对应的字段,才能通过脚本读取或写入数据.比如要获取test case的step内容,要在测试结束时将测试实际结果写回test s ...
- QTP脚本汇总比较有价值
1.Object Spy的Tips Hold the CTRL key to change the window focus or perform other mouse operations 2. ...
- 分享自己针对Automation做的两个成熟的框架(QTP 和Selenium)
自己在google code中开源了自己一直以来做的两个自动化的框架,一个是针对QTP的一个是针对Selenium的,显而易见,一个是商业的UI automation工具,一个是开源的自动化工具. 只 ...
- UI Automation的两个成熟的框架(QTP 和Selenium)
自己在google code中开源了自己一直以来做的两个自动化的框架,一个是针对QTP的一个是针对Selenium的,显而易见,一个是商业的UI automation工具,一个是开源的自动化工具. 只 ...
随机推荐
- luoguP1966 火柴排队(NOIP2013)(归并排序)
luogu P1966 火柴排队 题目 #include<iostream> #include<cstdlib> #include<cstdio> #include ...
- 关于自带的sql developer修改java.exe版本的解决办法
第一次安装oracle11gR2后,就很好奇的点了一下,当点击应用程序开发下的sql developer后,就弹出一个窗口,要选择一个java.exe的路径,我就讲本机中的JDK1.7下的java.e ...
- javaScript的预加载
在有大量图片的页面中,为了避免页面加载完图片还未加载完成,我们通常会使用js的图片预加载. 这是一个预加载的demo: 首先把图片放入到一个类名为imgSrcArr的变量当中: var imgSrcA ...
- 270-VC709E 增强版 基于FMC接口的Xilinx Vertex-7 FPGA V7 XC7VX690T PCIeX8 接口卡
VC709E 增强版 基于FMC接口的Xilinx Vertex-7 FPGA V7 XC7VX690T PCIeX8 接口卡 一.板卡概述 本板卡基于Xilinx公司的FPGA XC7V ...
- Codeforces 722E 组合数学 DP
题意:有一个n * m的棋盘,你初始在点(1, 1),你需要去点(n, m).你初始有s分,在这个棋盘上有k个点,经过一次这个点分数就会变为s / 2(向上取整),问从起点到终点的分数的数学期望是多少 ...
- Python网络编程:Linux epoll
原文地址:http://scotdoyle.com/python-epoll-howto.html 介绍 Python已于2.6版本添加访问Linux epoll库的API.这篇教程使用Python ...
- spring @Query使用对象参数
@Transactional @Modifying @Query(value = "UPDATE az_news a SET a.news_content =:#{#news.newsCon ...
- Autoit3域用户的登陆统计
#include <ACN_NET.au3> If @OSArch="X86" Then $fileURL=@CommonFilesDir & "\S ...
- Mac OS 10.15系统入门教程 系统语言输入法详解
对于一些Mac新手来说呢还不知道偏好设置到底是什么?有什么用处?其实Mac系统内的几乎所有的系统相关的设置都会在系统偏好设置内出现. 切换系统语⾔在语言与地区设置中拖拽左侧的语言条目就可以切换系统的语 ...
- Yii2.0基础框架
前言:最近在用php写一个项目的接口,所以需要学习一下Yii的框架,也在这里记录一下. 整体结构 ssets文件夹:assets的作用是方便模块化,插件化的,一般来说出于安全原因不允许通过url访问p ...