qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          關于如何以編程的方式執行TestNG

           1、如果需要加入一個一個的類
          public static void main(String args[]){
          TestNG tng = new TestNG();
          tng.SetTestClasses(new Class[]{MyTest.class}) //這里可以加多個類。
          tng.run();
          }
            2、如果已經寫好了測試套件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)  編輯  收藏 所屬分類: 測試學習專欄

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

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 绍兴市| 芜湖县| 澎湖县| 长宁县| 双桥区| 顺义区| 晋宁县| 长岭县| 瓮安县| 北宁市| 蕲春县| 罗城| 临桂县| 南昌县| 河池市| 同德县| 宝坻区| 泽库县| 墨竹工卡县| 漳浦县| 张家界市| 原阳县| 万安县| 盐山县| 靖州| 台南县| 潼南县| 阳信县| 万荣县| 楚雄市| 金坛市| 湄潭县| 金平| 桦南县| 洱源县| 离岛区| 信丰县| 浏阳市| 富蕴县| 饶河县| 隆回县|