在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 ...
随机推荐
- EMS设置发送连接器和接收连接器邮件大小
任务:通过EMS命令设置发送接收连接器和接收连接器的邮件大小限制值为50MB. 以Exchange管理员身份打开EMS控制台.在PowerShell命令提示符下. 键入以下命令设置接收-连接器的最大邮 ...
- phpshe xml注入
*php商城系统 xml注入* **页面样式* *Xml原理参考:* https://www.cnblogs.com/20175211lyz/p/11413335.html *漏洞函数simplexm ...
- JAVASE for 笔记
//0到100中奇数偶数的和package com.huang.boke.flowPath;public class Fordeme { public static void main(String[ ...
- Spring Boot配置druid监控页功能
1.导入坐标 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http ...
- Java 使用-安装
Java 使用-安装 官方网站 JDK 下载地址 JDK 历史版本 参考资料 CentOS7系统卸载自带的OpenJDK并安装SUNJDK CentOS7卸载 OpenJDK 安装Sun的JDK8 安 ...
- 利用js获取不同页面间跳转需要传递的参数
获取参数的js函数如下: function GetQueryValue(queryName) { var query = decodeURI(window.location.search.substr ...
- Python BeautifulSoup4 爬虫基础、多线程学习
针对 崔庆才老师 的 https://ssr1.scrape.center 的爬虫基础练习.Threading多线程库.Time库.json库.BeautifulSoup4 爬虫库.py基本语法
- springcloud集群测试
使用ribbon实现负载均衡,访问同一个url,轮询不同的服务提供端,从不同的数据库中取数据.
- 【课程汇总】OpenHarmony 成长计划知识赋能第二期课程(附链接)
OpenHarmony 开源开发者成长计划第二期知识赋能直播课程以入门为主,共设置 8 节课,覆盖了应用开发.设备开发.内核驱动等多个技术领域.带领开发者快速了解如何玩转 OpenHarmony.如何 ...
- JavaScript学习④
* BOM 1. 事件 ## DOM简单学习:为了满足案例要求 * 功能:控制html文档的内容 * 获取页面标签(元素)对象:Element * document.getElementById(&q ...