qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請?jiān)L問 http://qaseven.github.io/

          關(guān)于如何以編程的方式執(zhí)行TestNG

           1、如果需要加入一個(gè)一個(gè)的類
          public static void main(String args[]){
          TestNG tng = new TestNG();
          tng.SetTestClasses(new Class[]{MyTest.class}) //這里可以加多個(gè)類。
          tng.run();
          }
            2、如果已經(jīng)寫好了測試套件XML可以使用以下方式
          public static void main(String args[]){
          TestNG tng = new TestNG();
          RetryTestListener rtl = new RetryTestListener();
          XmlSuite xs = new XmlSuite();
          Parser parser = new Parser("./testxml/temp.xml");
          List<XmlSuite> suites = new ArrayList<XmlSuite>();
          try {
          suites = parser.parseToList();
          } catch (ParserConfigurationException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (SAXException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          };
          tng.setXmlSuites(suites);
          tng.addListener(rtl);
          tng.run();
          }

          posted on 2014-11-10 10:18 順其自然EVO 閱讀(234) 評論(0)  編輯  收藏 所屬分類: 測試學(xué)習(xí)專欄

          <2014年11月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 清水县| 泗洪县| 布尔津县| 工布江达县| 双城市| 台北市| 溆浦县| 绥江县| 元氏县| 常山县| 县级市| 道孚县| 象州县| 昌都县| 正宁县| 新宾| 依安县| 五河县| 浦江县| 吉林省| 娄烦县| 青铜峡市| 文昌市| 乡宁县| 盐津县| 辰溪县| 正镶白旗| 施秉县| 延津县| 宁晋县| 黄石市| 阿勒泰市| 公主岭市| 吉木乃县| 广宁县| 庆城县| 馆陶县| 曲周县| 阳城县| 宝山区| 资溪县|