Reportng 的测试报告在 Jenkins 中显示不全
通过Jenkins执行接口测试生成测试报告,用Jenkins的web服务打开html显示不全。
环境:
- Jenkins版本:1.651.2
- Jenkins发布在mac上面
- 使用的是testng管理测试用例,reportng进行报告的优化。
问题:reportng生成的html文件index.html是一个frameset框架,但是通过Jenkins查看index.html的时候,没有显示 元素。
实际显示效果:

通过Jenkins查看网页源码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" />
<!-- CSS Tabs is licensed under Creative Commons Attribution 3.0 - http://creativecommons.org/licenses/by/3.0/ -->
<style type="text/css">
body {
font: 100% verdana, arial, sans-serif;
background-color: #fff;
}
/* begin css tabs */
ul#tabnav { /* general settings */
text-align: left; /* set to left, right or center */
margin: 8px 0 0 0; /* set margins as desired */
font: bold 11px verdana, arial, sans-serif; /* set font as desired */
border-bottom: 1px solid #6c6; /* set border COLOR as desired */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}
ul#tabnav li { /* do not change */
display: inline;
}
ul#tabnav li.selected { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #fff; /* set background color to match above border color */
}
ul#tabnav li { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border: 1px solid #6c6; /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #cfc; /* set unselected tab background color as desired */
color: #666; /* set unselected tab link color as desired */
margin-right: 0px; /* set additional spacing between tabs as desired */
text-decoration: none;
border-bottom: none;
cursor: pointer;
}
ul#tabnav li:hover { /* settings for hover effect */
background: #afa; /* set desired hover color */
}
/* end css tabs */
/* FF 100% height iframe */
html, body, div, iframe { margin:0; padding:0; }
iframe { display:block; width:100%; border:none; }
h1
{
display: inline;
float: left;
font-size: small;
margin: 0;
padding: 0 10px;
}
h2
{
display: inline;
float: right;
font-size: small;
margin: 0;
padding: 0 10px;
}
</style>
<script type="text/javascript">
function updateBody(tabId, page) {
document.getElementById(selectedTab).setAttribute("class", "unselected");
tab = document.getElementById(tabId)
tab.setAttribute("class", "selected");
selectedTab = tabId;
iframe = document.getElementById("myframe");
iframe.src = tab.getAttribute("value");
}
function init(tabId){
updateBody(tabId);
updateViewport();
window.onresize = updateViewport;
}
function updateViewport(){
var viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportheight = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportheight = document.documentElement.clientHeight
}
// older versions of IE
else
{
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
iframe = document.getElementById("myframe");
iframe.style.height = (viewportheight-30)+'px';
}
var selectedTab = "tab1"
</script>
</head>
<body onload="init('tab1');">
<h1><a id="hudson_link" href="#"></a></h1>
<h2><a id="zip_link" href="#">Zip</a></h2>
<ul id="tabnav">
<li id="tab1" class="unselected" onclick="updateBody('tab1')" value="index.html">index</li><script type="text/javascript">document.getElementById("hudson_link").innerHTML="Back to ufenqi_test_interface_winxin";</script><script type="text/javascript">document.getElementById("hudson_link").href="/job/ufenqi_test_interface_winxin/";</script><script type="text/javascript">document.getElementById("zip_link").href="*zip*/HTML_Report.zip";</script></ul>
<div>
<iframe id="myframe" height="100%" width="100%" frameborder="0"></iframe>
</div>
</body>
</html>
本地打开的显示效果:

本地index.html的源码如下:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="" lang="">
<head>
<title>Test Results Report</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="TestNG unit test results." />
</head>
<frameset cols="20%,*">
<frame src="suites.html" name="suites" />
<frame src="overview.html" name="main" />
</frameset>
</html>
解决办法:
Jenkins会有一些默认的安全规则集,会影响一些插件的功能,去掉就可以了。启动Jenkins的时候添加参数即可。
- 默认的是:
java -jar /usr/local/Cellar/jenkins-lts/1.651.2/libexec/jenkins.war - 修改为:
java -Dhudson.model.DirectoryBrowserSupport.CSP= -jar /usr/local/Cellar/jenkins-lts/1.651.2/libexec/jenkins.war
详情请参考Jenkins安全策略配置说明
Reportng 的测试报告在 Jenkins 中显示不全的更多相关文章
- Android 6.0+ RecyclerView嵌套在ScrollView中显示不全
ScrollView嵌套RecyclerView在Android6.0以下能正常显示,但是在6.0以上就会出现RecyclerView显示不全的bug.尝试多种方法之后终于找到解决办法,特在此记录下. ...
- 托管到github上的网页图片在百度浏览器中显示不全
这几天做了个较完整的网页放到github上,上传后看网页效果. 在Firefox浏览器中,显示正常. 在百度浏览器中,空了一大块位置(图片位置),偏偏只空了这一块,其它地方的图片都好好的. 点击f12 ...
- Android--------解决ScrollView中嵌套ExpandableListView显示不全的问题
##***Scrollview和ExpandableListView嵌套显示不全*** - 当我们将ExpandableListView嵌套在Scrollview之中时,我们必须要确保我们的不居中Ex ...
- eclipse中xml下Namespaces显示不全的解决办法
1.问题描述: 如图,有时候编写spring相关的xml文件时,使用namepace中显示不全或者完全不显示 2.解决方法: Window —— Spring —— Beans Support ...
- Vue系列:在vux的popup组件中使用百度地图遇到显示不全的问题
问题描述: 将百度地图封装成一个独立的组件BMapComponent,具体见 Vue系列:如何将百度地图包装成Vue的组件(http://www.cnblogs.com/strinkbug/p/576 ...
- ScrollView中嵌套recycleView 出现的不显示,显示不全,终极解决方案
最近公司项目中用到了ScrollView去嵌套recycleView, 最开始我天真的把recycleView直接放入scrollView中,结果可想而知,什么都不显示,瞬间懵逼,我心想应该是和嵌套L ...
- Word03-文档中的截图显示不全
今天写文档时遇到个很蛋疼的问题,在doc文档中复制进去的截图总是显示不全,图片上半部分都被文字遮盖了,折腾半天,最后还是网上找到了答案. 解决方法如下: 将图片所在行的段落行距修改为其它值即可,原来为 ...
- HTML中的select下拉框内容显示不全的解决办法
HTML中的select下拉框内容显示不全的解决办法 今天,我遇到这样一个问题:查询栏中的下拉框中的内容过长,导致部分被覆盖了. 查询了一些资料,有的说用函数控制,有的说用事件控制,有的看不懂,有的实 ...
- JavaScript解决select下拉框中的内容太长显示不全的问题
JavaScript解决select下拉框中的内容太长显示不全的问题 1.说明 有些情况下,select下拉框的内容过长,导致部分看不见: 现在通过鼠标事件,让下拉框中的内容显示完全 2.实现源码 & ...
随机推荐
- 基于jwt和角色的访问控制解决方案
0,主要解决两个问题:1身份验证(防止httpclient拼接请求),2权限控制 1,身份验证使用jwt,在java就是jjwt jwt可以比较好的整合restful,对无状态客户端比较友好,(用se ...
- Arcmap10.1下安装ArcBrutile0.2.2 (Win7)(转)
前阵子换了高级新电脑,用的win7旗舰版装了Arcgis10.1,一直没试过ArcBrutile0.2.2能不能用,今天想用的时候发现自己竟然忘记怎么加载这个工具了!!! 网上搜了一下,度娘今天不 ...
- 支付宝sdk集成
支付宝开放平台 http://doc.open.alipay.com/doc2/detail?treeId=59&articleId=103563&docType=1 集成步骤: 1. ...
- MySQL error : Deadlock found when trying to get lock; try restarting transaction
在使用 MySQL 时,我们有时会遇到这样的报错:“Deadlock found when trying to get lock; try restarting transaction”. 在 14. ...
- Python模块详解以及import本质,获得文件当前路径os.path.abspath,获得文件的父目录os.path.dirname,放到系统变量的第一位sys.path.insert(0,x)
模块介绍 1.定义: 模块:用来从逻辑上组织python代码(变量,函数,类,逻辑:实现一个功能),本质就是.py结尾的python文件(文件名:test.py,对应的模块名:test) 包:用来从逻 ...
- PHP中的use、命名空间的理解
看.Net中的命名空间和using using Ddd.Core; using Ddd.Core.Caching; using Ddd.Core.Data; using Ddd.Core.Domain ...
- C++对Lua中table进行读取、修改和创建
C++代码: // LuaAndC.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> #i ...
- mysql索引原理与慢查询优化1
一 介绍 为何要有索引? 一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,在生产环境中,我们遇到最多的,也是最容易出问题的,还是一些复杂的查询操作,因此对查询语句 ...
- leetcode606
/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...
- leetcode599
public class Solution { public string[] FindRestaurant(string[] list1, string[] list2) { var dic = n ...