Using XML::XSLT to make your test results pretty
来源:互联网 发布:罗志祥女友的淘宝店 编辑:程序博客网 时间:2024/06/05 00:57
This question came up at QAForums recently:
Q: Is it possible to export QTP results to HTML format?
A: Mercury has provided nearly everything you'd ever need to make this happen, and it's highly customizable if you take the time to learn XSLT.
XSLT is a simple technology, used to transform XML documents into other kinds of documents. QTP comes with three XSL files, which transform the Results.xml file into perfectly readable HTML code.
These stylesheets live in the <QTP root>/dat/ folder (on mine, it's C:/Program Files/Mercury Interactive/QuickTest Professional/dat):
PShort.xsl
PDetails.xsl
PSelection.xsl
When the test run report is generated, it's stored in a directory something like this:
<test folder>/Res1/Report/Results.xml
To see it, you have to add the following line below the XML declaration in Results.xml, so it looks like this:
- <?xml version="1.0"?>
- <!-- This assumes you've made the PShort.xsl file available via a web server!! -->
- <?xml-stylesheet href="http://localhost/qtp/PShort.xsl" type="text/xsl"?>
Then view the Results.xml file in IE (which has an XSL engine built into it).
What we do is, we use an external XSLT transformation tool called 'xsltproc' (which comes from the LibXML2 suite at XMLSoft) to generate an HTML file, which we then upload to a server that archives all our test result information. That way nobody needs Mercury's Results Viewer app (that blasted thing takes you through too many clicks to get what you want, and it doesn't remember your filter preferences from one session to the next... GARR!!!!)
This is much better for everyone on my team.
So, it's not difficult, and you have everything you need already. Now if only there were a way to have QTP insert that stylesheet declaration by default into every test...
You do not need to link the xml and the xslt inside the xml file.
You can create a new html that points to a xml file and also a xslt file.
e.g.
// Load XML
var xml = new ActiveXObject(”Microsoft.XMLDOM”)
xml.async = false
xml.load(”Results.xml”)// Load XSL
var xsl = new ActiveXObject(”Microsoft.XMLDOM”)
xsl.async = false
xsl.load(”PShort.xsl”)// Transform
document.write(xml.transformNode(xsl))
You should be able to get QTP to create a html like this to point to the correct results.xml.
- Using XML::XSLT to make your test results pretty
- Simple sample for transforming XML to HTML by using XSLT
- Demand response: using your data center to make money
- DEMAND RESPONSE: USING YOUR DATA CENTER TO MAKE MONEY
- Using sipp to stress test your asterisk 1.4 pbx system
- NDoc: How to Make Good Use of Your XML Comments?
- NDoc: How to Make Good Use of Your XML Comments?
- NDoc: How to Make Good Use of Your XML Comments?
- [GUIDE] How to make a nandroid backup directly to your computer without using sdcard
- “make clean” results in “No rule to make target `clean'”
- Save an XML File to Database and Send an Email using XSLT
- How to Make an Pretty "Under Construction" Homepage
- Transform XML into HTML using XSLT
- Using XML And XSLT In Delphi
- Transform XML into HTML using XSLT
- Transform XML into HTML using XSLT
- 使用FOR XML将查询结果以XML格式返回(Using the FOR XML Clause to Return Query Results as XML)
- Using Powerpoints to your benefit.
- 数据表中查询日期字段为空的记录并进行赋值的方法
- spring 对hessian支持
- 购物网站13:顾客/用户管理Service
- August,31 (R)
- 购物网站14:WEB action:系统初始化action
- Using XML::XSLT to make your test results pretty
- 购物网站15:订单action---订单分页列表----订单管理----订单信息查看
- CGI 程 式 设 计
- 关于线程和进程
- 购物网站16-1:权限action----部门列表---部门管理----员工列表----员工登录---员工注销----员工管理
- High Performance MySQL chapter 1
- VB6结合GDI+实现内存(Stream)压缩/解压缩JPG(JPEG)图像
- 初识vim+gcc+gdb
- 关于SIP库模块划分的重思考