zhyiwww
          用平實(shí)的筆,記錄編程路上的點(diǎn)點(diǎn)滴滴………
          posts - 536,comments - 394,trackbacks - 0
          自己寫了一個(gè)TestSuite,想進(jìn)行聯(lián)合測(cè)試,可以用run as junit卻怎么也運(yùn)行不了。
          后來從網(wǎng)上找了些例子,可以用應(yīng)用程序的方式來進(jìn)行TestSuit測(cè)試
          代碼如下:

          public class AllTests {

          ??? public static Test suite() {
          ??? ??? TestSuite suite = new TestSuite(
          ??? ??? ??? ??? "Test for XXXX “);
          ??? ???
          ??? ??? suite.addTestSuite(XmlUtilTest.class);
          ??? ??? suite.addTestSuite(HibernateSessionFactoryTest.class);
          ??? ??? suite.addTestSuite(SsFactoryTest.class);
          ??? ??? suite.addTestSuite(TcccDaoTest.class);
          ??? ??? suite.addTestSuite(TcddDaoTest.class);
          ??? ??? suite.addTestSuite(TiddDaoTest.class);
          ??? ???
          ??? ??? TestResult rst = new TestResult();
          ??? ??? suite.run(rst);
          ??? ???
          //??? ??? System.out.println(rst.errorCount()+rst.failureCount()+rst.runCount());
          ??? ???
          ??? ??? if(rst.wasSuccessful()){
          ??? ??? ??? System.out.println("ok");
          ??? ??? }
          ??? ???
          ??? ??? return suite;
          ??? }

          ??? public static void main(String[] args) {
          ??? ??? suite();
          ??? }

          }

          然后按照應(yīng)用程序來運(yùn)行就可以了。
          運(yùn)行的結(jié)果都保存在TestResult里面。




          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請(qǐng)注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2009-01-05 15:06 zhyiwww 閱讀(506) 評(píng)論(0)  編輯  收藏 所屬分類: j2ee軟件測(cè)試
          主站蜘蛛池模板: 磴口县| 福鼎市| 崇左市| 浪卡子县| 上蔡县| 峨边| 若羌县| 龙游县| 南漳县| 双辽市| 长子县| 石屏县| 海晏县| 凭祥市| 怀宁县| 台江县| 桐柏县| 马边| 富顺县| 女性| 邵武市| 象州县| 塔城市| 芜湖县| 三穗县| 宁强县| 巴林左旗| 新龙县| 汉中市| 宣化县| 哈尔滨市| 西林县| 阳信县| 平邑县| 永修县| 启东市| 阿鲁科尔沁旗| 威信县| 建阳市| 万荣县| 六盘水市|