51Testing软件测试论坛

标题: 求教---关于TestNG-xslt [打印本页]

作者: 47385024    时间: 2010-6-14 16:14
标题: 求教---关于TestNG-xslt
我在Myeclipse运行selenium-RC的成功,在lib里添加了testng-results.xsl和testng-results.xml,创建了Build.xml,Myeclipse运行后提示:BUILD SUCCESSFUL。CMD运行 ant transform后,提示:
  1. Microsoft Windows XP [Version 5.1.2600]
  2. (C) Copyright 1985-2001 Microsoft Corp.

  3. C:\Documents and Settings\Administrator>cd C:\Documents and Settings\Administrat
  4. or\Workspaces\MyEclipse 8.5\Test-20100611\src

  5. C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test-20100611\s
  6. rc>ant transform build.xml
  7. Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
  8. b\tools.jar
  9. Buildfile: C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test
  10. -20100611\src\build.xml

  11. transform:
  12.      [xslt] Processing C:\Documents and Settings\Administrator\Workspaces\MyEcli
  13. pse 8.5\Test-20100611\Lib\testng-results.xml to C:\a\index.html
  14.      [xslt] Loading stylesheet C:\Documents and Settings\Administrator\Workspace
  15. s\MyEclipse 8.5\Test-20100611\Lib\testng-results.xsl
  16.      [xslt] : Error! Syntax error in 'if ($testNgXslt.testDetailsFilter) then $t
  17. estNgXslt.testDetailsFilter else 'FAIL,PASS,SKIP''.
  18.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  19. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 23: Error parsing X
  20. Path expression 'if ($testNgXslt.testDetailsFilter) then $testNgXslt.testDetails
  21. Filter else 'FAIL,PASS,SKIP''.
  22.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  23. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 23: Required attrib
  24. ute 'select' is missing.
  25.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  26. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 12: The method attr
  27. ibute of an <xsl:output> element had the value 'xhtml'.  The value must be one o
  28. f 'xml', 'html', 'text', or qname-but-not-ncname
  29.      [xslt] : Error! Syntax error in 'if (suite/@url) then document(suite/@url)/
  30. suite else suite'.
  31.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  32. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 425: Error parsing
  33. XPath expression 'if (suite/@url) then document(suite/@url)/suite else suite'.
  34.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  35. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 425: Required attri
  36. bute 'select' is missing.
  37.      [xslt] : Error! Syntax error in 'if (test/@url) then document(test/@url)/te
  38. st else test'.
  39.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  40. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 694: Error parsing
  41. XPath expression 'if (test/@url) then document(test/@url)/test else test'.
  42.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  43. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 694: Required attri
  44. bute 'select' is missing.
  45.      [xslt] : Error! Syntax error in 'if (compare($sortByStartTime, 'true') = 0)
  46. then @started-at else '''.
  47.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  48. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 896: Error parsing
  49. XPath expression 'if (compare($sortByStartTime, 'true') = 0) then @started-at el
  50. se '''.
  51.      [xslt] : Error! Syntax error in 'if (compare($testNgXslt.sortTestCaseLinks,
  52. 'true') = 0) then @name else '''.
  53.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  54. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 1008: Error parsing
  55. XPath expression 'if (compare($testNgXslt.sortTestCaseLinks, 'true') = 0) then
  56. @name else '''.
  57.      [xslt] : Error! Syntax error in 'null'.
  58.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  59. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 1015: Error parsing
  60. XPath expression 'null'.
  61.      [xslt] : Error! Syntax error in 'if ($totalCount > 0) then format-number($p
  62. assedCount div $totalCount, '###%') else '100%''.
  63.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  64. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 1090: Error parsing
  65. XPath expression 'if ($totalCount > 0) then format-number($passedCount div $tot
  66. alCount, '###%') else '100%''.
  67.      [xslt] : Error! file:/C:/Documents%20and%20Settings/Administrator/Workspace
  68. s/MyEclipse%208.5/Test-20100611/Lib/testng-results.xsl: line 1090: Required attr
  69. ibute 'select' is missing.
  70.      [xslt] : Fatal Error! Could not compile stylesheet
  71.      [xslt] Failed to process C:\Documents and Settings\Administrator\Workspaces
  72. \MyEclipse 8.5\Test-20100611\Lib\testng-results.xml

  73. BUILD FAILED
  74. C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test-20100611\s
  75. rc\build.xml:10: Fatal error during transformation

  76. Total time: 0 seconds
  77. C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test-20100611\s
  78. rc>
复制代码
请问是怎么回事?  谢谢

ant已经配置完了,就是不知道怎么运行能出测试报告。请帮忙看下  

下面是build.xml文件
  1. <project name="Test-20100611" basedir=".">
  2.     <property name="lib.dir" value="lib"/>

  3.     <path id="test.classpath">
  4.          <!-- adding the saxon jar to your classpath -->
  5.         <fileset dir="${lib.dir}" includes="*.jar"/>
  6.     </path>

  7.     <target name="transform">
  8.         <xslt in="C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test-20100611\Lib\testng-results.xml" style="C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Test-20100611\Lib\testng-results.xsl" out="C:\a\index.html">
  9.              <!-- you need to specify the directory here again -->
  10.             <param name="testNgXslt.outputDir" expression="C:\a\"/>
  11.             <classpath refid="test.classpath"/>
  12.             </xslt>
  13.     </target>
  14. </project>
复制代码

[ 本帖最后由 小米啊 于 2010-6-18 19:06 编辑 ]
作者: 47385024    时间: 2010-6-15 11:53
莫非我的帖子就像世界杯一样充满了悬念???丢鸡蛋撒

自己扔自己鸡蛋?!~~您受了什么刺激了?!

作者: 47385024    时间: 2010-6-16 21:18
自己顶一下  手工置顶
作者: 47385024    时间: 2010-6-17 10:01
每天顶一下  先置顶一周吧  看能解决不

看不惯  请删帖  谢谢::xykwd:::
作者: 小米啊    时间: 2010-6-17 14:52
这么漂亮的东西,我也没有学习过,我下班也学习下.

看你的报错是你的java环境,没有配置好?
你把tools.jar加到classpath了否
作者: 47385024    时间: 2010-6-17 19:32
和那个JAR包没关系   不过现在已经搞定了  可以结贴了


[attach]63055[/attach]

虽然有些丑   呵呵  不过作为第一个report  我就忍了   以后改进::xykwd:::

[ 本帖最后由 47385024 于 2010-6-17 19:34 编辑 ]
作者: 小米啊    时间: 2010-6-17 20:50
原因是什么呢。贴出来吧。以后碰到其它人可以节省时间了,谢谢!
作者: 47385024    时间: 2010-6-18 10:20
的确是环境问题   Build.xml文件要放在项目的根目录下    我放到了src下面 呵呵   testng找不到了

这几天没时间了   改天总结一下  发上来  呵呵 ::xykwd:::

呵呵  这个东西挺有意思的   今天换了个reportng   感觉好多了   不那么丑了  呵呵

[attach]63079[/attach]

[ 本帖最后由 47385024 于 2010-6-18 16:51 编辑 ]
作者: 马德里不思议    时间: 2011-3-23 17:43
我ANT以后,转换后的HTML,也生成了,但是里面是空白的,不清楚原因




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2