亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 > TestNG
使用TestNG的新特性管理實際項目中的大量單元測試
作者:網絡轉載 發布時間:[ 2013/3/15 13:59:56 ] 推薦標簽:

TestNG 的示例代碼

TestNG 提供了從命令行運行測試用例的方法。下面將首先從命令行運行測試用例。假設有如下的測試用例組:

列表 1. TestNG 示例代碼

    
 package example1;

 import org.testng.annotations.*;

 public class SimpleTest {

  @Configuration(beforeTestClass = true)
  public void setUp() {
    // code that will be invoked when this test is instantiated
  }

  @Test(groups = { "HelloWorld" })
  public void helloWorldTest() {
    System.out.println("Hello World");
    throw new Error();
  }

  @Test(threadPoolSize = 10, invocationCount = 5, 
  timeOut = 1000, groups = { "multiple" })
  public void multiThreadTest() {
     System.out.println("MultiThread test");
  }

  @Test(groups = { "HelloNature" })
  public void helloNatureTest() {
     System.out.println("Hello Nature");
     throw new Error();
  }
 }

    


運行 TestNG 的 Ant 腳本

為了運行這組測試用例,構建了如下的 Ant 運行腳本:

列表 2. 運行測試用例組的 Ant 腳本 build.xml 文件

    
 <project default="test">

  <path id="cp">
    <pathelement location=
    "c:/spark/eclipse/plugins/org.testng.eclipse_4.7.0.0/lib/testng-jdk15.jar"/>
    <pathelement location="c:"/>
  </path>
 
  <taskdef name="testng" classpathref="cp"
           classname="org.testng.TestNGAntTask" />

 <target name="test">
    <testng classpathref="cp" groups="HelloWorld, HelloNature">
      <classfileset dir="./" includes="example1/*.class"/>
    </testng>
  </target>
 
 </project>


運行之后的結果如下:

圖 1. 命令行運行 TestNG 的結果

運行完成之后,會在運行目錄下生成一個 test-output 目錄。如圖 2 所示:

圖 2. 生成的 test-output 目錄

該目錄中包含有 html 形式的運行結果的報告,通過命令 start test-outputindex.html 可以查看生成的測試報告。

上一頁123下一頁
軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 成人在线观看免费 | 天干天夜啪天天碰 | 狠狠色狠狠色很很综合很久久 | 麻豆国产 | 色综合手机在线 | 午夜在线| 永久在线毛片免费观看 | 成年色黄大色黄大片 视频 成年日韩免费大片黄在线观看 | 午夜影院免费观看 | 欧美日韩在线观看精品 | 又黄又爽视频好爽视频 | 特级黄视频 | h视频在线观看视频观看 | 91在线精品麻豆欧美在线 | 日本一区二区中文字幕 | 亚洲欧美日韩天堂在线观看 | 日韩不卡在线观看 | 亚洲68283精品人体 | 中文字幕第九页 | 亚洲一级高清在线中文字幕 | 欧美疯狂xxxx乱大交视频 | 怡春院在线观看 | 手机看片日韩国产一区二区 | 久操成人 | 九九伦理影院手机观看 | 国产高清专区 | 久草综合视频在线 | bban在线| 日本理论午夜中文字幕第一页 | 在线观看色视频网站 | 久久国产免费观看精品1 | 亚洲第一成年免费网站 | 2048国产精品原创综合在线 | 国产成人国产在线观看入口 | 久操视频免费看 | 日韩在线视频精品 | 天天干天天干天天干天天 | 男女在线 | 啪啪免费网站入口链接 | 一级二级三级黄色片 | 国产高清天干天天美女 |