51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 6397|回复: 8
打印 上一主题 下一主题

求教---关于TestNG-xslt

[复制链接]
  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    跳转到指定楼层
    1#
    发表于 2010-6-14 16:14:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    我在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 编辑 ]
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    2#
     楼主| 发表于 2010-6-15 11:53:12 | 只看该作者
    莫非我的帖子就像世界杯一样充满了悬念???丢鸡蛋撒

    自己扔自己鸡蛋?!~~您受了什么刺激了?!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    3#
     楼主| 发表于 2010-6-16 21:18:53 | 只看该作者
    自己顶一下  手工置顶
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    4#
     楼主| 发表于 2010-6-17 10:01:05 | 只看该作者
    每天顶一下  先置顶一周吧  看能解决不

    看不惯  请删帖  谢谢::xykwd:::
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
    发表于 2010-6-17 14:52:00 | 只看该作者
    这么漂亮的东西,我也没有学习过,我下班也学习下.

    看你的报错是你的java环境,没有配置好?
    你把tools.jar加到classpath了否
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    6#
     楼主| 发表于 2010-6-17 19:32:33 | 只看该作者
    和那个JAR包没关系   不过现在已经搞定了  可以结贴了




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

    [ 本帖最后由 47385024 于 2010-6-17 19:34 编辑 ]

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2010-6-17 20:50:15 | 只看该作者
    原因是什么呢。贴出来吧。以后碰到其它人可以节省时间了,谢谢!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-6-28 13:31
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    8#
     楼主| 发表于 2010-6-18 10:20:10 | 只看该作者
    的确是环境问题   Build.xml文件要放在项目的根目录下    我放到了src下面 呵呵   testng找不到了

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

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



    [ 本帖最后由 47385024 于 2010-6-18 16:51 编辑 ]

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    9#
    发表于 2011-3-23 17:43:13 | 只看该作者
    我ANT以后,转换后的HTML,也生成了,但是里面是空白的,不清楚原因
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-5-4 23:50 , Processed in 0.078077 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表