将QTP运行时的错误截图上传到QC
Class QCImageErrorCapture
Sub Class_Terminate()
'Check if the current test has failed. If failed then only capture screenshot
If Reporter.RunStatus = micFail Then
CaptureAndAttachDesktop
End If
End Sub
Private Sub CaptureAndAttachDesktop()
'QC is not connected
If QCUtil.IsConnected = False then Exit Sub
'The test is not running from Test Lab
If QcUtil.CurrentRun is Nothing Then Exit Sub
On error resume next
'Hide QTP to make sure we don't get QTP in snapshot
Set qtpApp = CreateObject("QuickTest.Application")
qtpApp.visible = False
'GIve time for QTP to get hidden
Wait 2
'Capture the screenshot to the report folder
Desktop.CaptureBitmap Reporter.ReportPath & "/Report/ErrorImage.png", True
qtpApp.visible = True
'Add the capture to QC
Set oAttachments = QCutil.CurrentRun.Attachments
Set oAttachment = oAttachments.AddItem(null)
oAttachment.FileName = Reporter.ReportPath & "/Report/ErrorImage.png"
oAttachment.Type = 1 'File
'Check if the current test is a QTP Test or Business Component
Select Case LCase(qtpApp.CurrentDocumentType)
Case "test"
oAttachment.Description = "Name: " & qtpApp.Test.Name & vbNewLine & "Error: " & qtpApp.Test.LastRunResults.LastError
Case "business component"
oAttachment.Description = "Name: " & qtpApp.BusinessComponent.Name & vbNewLine & "Error: " & qtpApp.BusinessComponent.LastRunResults.LastError
'We can also add the Business COmponent to a User Defined Field
'QCUtil.CurrentTestSetTest.Field("TC_USER_01") = qtpApp.BusinessComponent.Name
'QCUtil.CurrentTestSetTest.Post
End Select
'Add the attachment
oAttachment.Post
End Sub
End Class
'Create the object in one of the attached libraries. When the Test or Business component ends
'the screenshot will be captured
Set oErrorCapture = new QCImageErrorCapture
将上述代码直接复制到函数库中并关联当前QTP脚本,那么在运行过程中发生的错误截图就会自动上传至QC。
将QTP运行时的错误截图上传到QC的更多相关文章
- Erlang运行时的错误
Erlang运行时发生错误时,会返回一些错误信息,理解这些信息,对于学好.用好Erlang来说是必要. Erlang中的运行错误包括:badarg, badarith, badmatch, funct ...
- docker 运行时常见错误
docker 运行时常见错误 (1) Cannot connect to the Docker daemon at unix:///var/run/docker.sock. [root@localho ...
- ASP.NET MVC 网站开发总结(三) ——图片截图上传
本着简洁直接,我们就直奔主题吧,这里需要使用到一个网页在线截图插件imgareaselect(请自行下载). 前台页面: <!DOCTYPE html> <html> < ...
- 在Asp.Net Core中配置使用MarkDown富文本编辑器实现图片上传和截图上传(开源代码.net core3.0)
我们的富文本编辑器不能没有图片上传尤其是截图上传,下面我来教大家怎么实现MarkDown富文本编辑器截图上传和图片上传. 1.配置编辑器到html页 <div id="test-edi ...
- JS打开摄像头并截图上传
直入正题,JS打开摄像头并截图上传至后端的一个完整步骤 1. 打开摄像头主要用到getUserMedia方法,然后将获取到的媒体流置入video标签 2. 截取图片主要用到canvas绘图,使用dra ...
- 头像截图上传三种方式之一(一个简单易用的flash插件)(asp.net版本)
flash中有版权声明,不适合商业开发.这是官网地址:http://www.hdfu.net/ 本文参考了http://blog.csdn.net/yafei450225664/article/det ...
- linux 运行时加载不上动态库 解决方法(转)
1. 连接和运行时库文件搜索路径到设置 库文件在连接(静态库和共享库)和运行(仅限于使用共享库的程序)时被使用,其搜索路径是在系统中进行设置的.一般 Linux 系统把 /lib 和 /usr ...
- 关于bootstrap中cropper的截图上传问题
之前做一个关于截图的东东,搞了好久终于弄好了,其主要关键是把前端截图的数据(x坐标,y坐标,宽度,高度和旋转角度)传到后台,然后在后台对图片做相关处理,记录一下方便以后查看. 后台配置为ssm. Ja ...
- iOS之苹果调整 App Store 截图上传规则,截图尺寸、大小等
作者:ASO100链接:https://zhuanlan.zhihu.com/p/23041522来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 自从 8 月中旬苹果向 ...
随机推荐
- nginx配置多个server,搭建多个站点
今天域名备案终于成功了,赶紧进行了域名的绑定,在配置vhosts的时候发现了一个default_server 字段,对于这个字段之前没有接触过,后来查了一下,其实是这样的 当用户在浏览器中输入相关域名 ...
- sshpass非交互SSH密码验证
1.yum安装yum install sshpass -y1.1编译安装yum install wget -ywget http://sourceforge.net/projects/sshpass/ ...
- psfstriptable - 从控制台字体中移走嵌入的Uniocde字符表
总览 psfstriptable 字体文件 [输出文件] 描述 psfstriptable 命令从 字体文件 或者标准输入(此时的 字体文件 是单个破折号(-))读取一个可能含有嵌入Unicode字体 ...
- CentOS7.6系统安装zabbix3.4.8客户端
一. 准备安装包 将本地的zabbix-3.4.8软件包上传至服务器, 二. 安装依赖包 安装依赖包:yum install gcc* pcre* psmisc -y 三. 安 ...
- 二、jquery Try{}catch(e){}
一.Try{}catch(e){} try{ $.each($("div"),function(i,item){ if(...){ throw("异常信息"); ...
- 初学Java 数值运算符
import java.util.Scanner; public class DisplayTime { public static void main(String[] args) { Scanne ...
- HDU 6686 Rikka with Travels 树的直径
题意:定义两点之间的距离为从一个点到另一个点经过的点数之和(包括这两个点),设二元组(x, y)为两条不相交的路径,一条长度为x,一条长度为y,问二元组(x, y)出现了多少次? 思路:直接上jls的 ...
- C#基础知识之类和结构
虽然项目中一直在使用类.结构体等类型,仔细琢磨,还真无法系统的说出个所以然.记录一下类.结构体.类和结构体区别 一.类 对于类,大家都特别熟悉.简单的介绍一下类的结构,然后记录一下Class需要注意的 ...
- 英语单词profile
profile 来源——linux系统文件名 [root@centos71 ~]# cat /etc/profile # /etc/profile # System wide environment ...
- UIView响应事件的两个方法
参考自:https://blog.csdn.net/mushaofeng1990/article/details/62434349 用户触摸屏幕后的事件传递过程: //方法A-(UIView *)hi ...