在Rally上,上传测试报告(文件)到每个Test Case方法
本文链接: https://www.cnblogs.com/hchengmx/p/how-to-upload-test-result-to-test-case-result-in-rally.html
步骤一:创建类型为testcaseresult的create request,得到test case result的ref link
JsonObject newTestCaseResult = new JsonObject();
newTestCaseResult.addProperty("Verdict", verdict);
newTestCaseResult.addProperty("Date", s1);
newTestCaseResult.addProperty("Notes", Notes);
newTestCaseResult.addProperty("Build", Build);
newTestCaseResult.addProperty("TestCase", testCaseRef);
newTestCaseResult.addProperty("Tester", getUserReference(restApi, username));
System.out.println("Test case result request is " + newTestCaseResult);
CreateRequest testCaseResultCreateRequest = new CreateRequest("testcaseresult", newTestCaseResult);
CreateResponse testCaseResultCreateResponse = restApi.create(testCaseResultCreateRequest);
步骤二:读取文件,把文件的Content转为Base64
RandomAccessFile myFileHandle = new RandomAccessFile(path, "r");
byte[] fileBytes = new byte[fileLength];
myFileHandle.readFully(fileBytes);
String attachmentBase64String = Base64.encodeBase64String(fileBytes);
步骤三:创建类型为AttachmentContent的create request,得到attachmentContentRef
JsonObject myAttachmentContent = new JsonObject();
myAttachmentContent.addProperty("Content", attachmentBase64String);
CreateRequest attachmentContentCreateRequest = new CreateRequest("AttachmentContent", myAttachmentContent);
CreateResponse attachmentContentResponse = restApi.create(attachmentContentCreateRequest);
步骤四:创建类型为Attachment的create request,其中有test case result属性,值为步骤一得到的ref,content属性,为步骤三得到的ref
JsonObject myAttachment = new JsonObject();
myAttachment.addProperty("TestCaseResult", ref);
myAttachment.addProperty("Content", myAttachmentContentRef);
myAttachment.addProperty("Name", filename);
myAttachment.addProperty("Description", "Attachment From Automation");
myAttachment.addProperty("ContentType", "application/octet-stream");
myAttachment.addProperty("Size", attachmentSize);
myAttachment.addProperty("User", getUserReference(restApi, username));
CreateRequest attachmentCreateRequest = new CreateRequest("Attachment", myAttachment);
CreateResponse attachmentResponse = restApi.create(attachmentCreateRequest);
在Rally上,上传测试报告(文件)到每个Test Case方法的更多相关文章
- upload控件上传json文件合并的两种方法
方法一: byte[] byte1 = FileUpload1.FileBytes; byte[] byte2 = FileUpload2.FileBytes; byte[] a1 = Encodin ...
- linux学习笔记-linux主机上传下载文件至linux虚拟机的方法
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 1.上传文件 scp -r file 用户名@ip地址:目标目录 2.下载文件 scp -r 用户名@ip地址:文件 目标目录
- 三种上传文件不刷新页面的方法讨论:iframe/FormData/FileReader
发请求有两种方式,一种是用ajax,另一种是用form提交,默认的form提交如果不做处理的话,会使页面重定向.以一个简单的demo做说明: html如下所示,请求的路径action为"up ...
- struts2实现文件上传(多文件上传)及下载
一.要实现文件上传,需在项目中添加两个jar文件 二.上传准备的页面 注:必须植入enctype="multipart/form-data"属性,以及提交方式要设置成post &l ...
- spring mvc文件上传(单个文件上传|多个文件上传)
单个文件上传spring mvc 实现文件上传需要引入两个必须的jar包 1.所需jar包: commons-fileupload-1.3.1.jar ...
- 用百度webuploader分片上传大文件
一般在做文件上传的时候,都是通过客户端把要上传的文件上传到服务器,此时上传的文件都在服务器内存,如果上传的是视频等大文件,那么服务器内存就很紧张,而且一般我们都是用flash或者html5做异步上传, ...
- Linux上传下载文件快捷命令
远程链接Linux(如SecrueCRT),要上传文件很下载文件到Linux服务器,只需要使用sz或者rz命令即可快速下载和上传文件了. 使用方法: 1.首先确保Linux服务器系统中安装了lrzsz ...
- 利用SkyDrive Pro 迅速批量下载SharePoint Server 上已上传的文件
在上一篇<SharePoint Server 2013 让上传文件更精彩>,我们一起了解了如何快速的方便的上传批量文件到SharePoint Server 2013 ,而在这一篇日志中您将 ...
- 用java 代码下载Samba服务器上的文件到本地目录以及上传本地文件到Samba服务器
引入: 在我们昨天架设好了Samba服务器上并且创建了一个 Samba 账户后,我们就迫不及待的想用JAVA去操作Samba服务器了,我们找到了一个框架叫 jcifs,可以高效的完成我们工作. 实践: ...
- [Asp.net]Uploadify上传大文件,Http error 404 解决方案
引言 之前使用Uploadify做了一个上传图片并预览的功能,今天在项目中,要使用该插件上传大文件.之前弄过上传图片的demo,就使用该demo进行测试.可以查看我的这篇文章:[Asp.net]Upl ...
随机推荐
- Django-初见
目录 安装&启动 HTTP请求URL路由 项目APP 返回 页面内容 给浏览器 路由 路由子表 创建数据库 定义数据库表 创建数据库表 Django Admin 读取数据库数据 过滤条件 对资 ...
- IDEA Debug过程中使用Drop Frame或Reset Frame实现操作回退
大家在Debug程序的时候,是否遇到过因为"下一步"按太快,而导致跳过了想要深入分析的那段代码?是不是很想要有"回到上一步"这样的操作呢? 在IDEA中就提供了 ...
- C# 中托管内存与非托管内存之间的转换
c#有自己的内存回收机制,所以在c#中我们可以只new,不用关心怎样delete,c#使用gc来清理内存,这部分内存就是managed memory,大部分时候我们工作于c#环境中,都是在使用托管内存 ...
- 2022-Aech安装(详细)
官方wiki:https://wiki.archlinux.org/ 基础安装 一:制作安装介质 下载ISO镜像文件: https://archlinux.org/download/ # 官方下载网址 ...
- windwos 下编译 qsqlibase 驱动(firebird 和 interbase)
编译环境:mingw-w64 使用qtcreator打开ibase.pro,ibase.pro位置例如:R:\qt-everywhere-opensource-src-4.8.5\src\plugin ...
- Python 爬取1688货源重量,自动发邮件到指定邮箱(qq),设置定时运行程序
1 # -*- coding: utf-8 -*- 2 # @Time : 2020/7/6 13:46 3 # @Author : Chunfang 4 # @Email : 3470959534@ ...
- 关于openstreet map的osm文件转shp文件方法(附arcgis10.2插件)
一.下载并安装对应arcgis版本的osm插件 对应arcgis版本的osm转换插件在arcgis官网可以下载 http://www.arcgis.com/home/search.html?q=Arc ...
- 关于visualvm无法监控本地java进程
https://blog.csdn.net/weixin_43827693/article/details/105990675?spm=1001.2101.3001.6661.1&utm_me ...
- 如何设计一个良好的API接口?
沟通创造价值,分享带来快乐.这里是程序员阅读时间,每天和你分享读书心得,欢迎您每天和我一起精进.今天和大家一起讨论的话题是如何设计一个良好的API接口? 作者:梁桂钊 解读:张飞洪 挑战 API是软件 ...
- “如何实现集中管理、灵活高效的CI/CD”研讨会报名即将截止
如何实现集中管理.灵活高效的CI/CD ZOOM中文在线研讨会将于 2022年3月29日,星期二,下午3:00-5:00, 也就是 明天 举行, 如果您还未注册,点击按钮,立即注册此次研讨会(注册即可 ...