zhyiwww
          用平實(shí)的筆,記錄編程路上的點(diǎn)點(diǎn)滴滴………
          posts - 536,comments - 394,trackbacks - 0
          自己寫了一個(gè)TestSuite,想進(jìn)行聯(lián)合測(cè)試,可以用run as junit卻怎么也運(yùn)行不了。
          后來(lái)從網(wǎng)上找了些例子,可以用應(yīng)用程序的方式來(lái)進(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)用程序來(lái)運(yùn)行就可以了。
          運(yùn)行的結(jié)果都保存在TestResult里面。




          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請(qǐng)注明來(lái)源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2009-01-05 15:06 zhyiwww 閱讀(514) 評(píng)論(0)  編輯  收藏 所屬分類: j2ee軟件測(cè)試
          主站蜘蛛池模板: 白沙| 英吉沙县| 和林格尔县| 伊春市| 锦州市| 通城县| 夏河县| 方正县| 南雄市| 怀柔区| 建宁县| 武城县| 闽侯县| 淮北市| 海城市| 宁河县| 思南县| 安福县| 启东市| 苗栗市| 冕宁县| 丰城市| 临洮县| 荥经县| 兴安盟| 隆子县| 昌乐县| 罗甸县| 集贤县| 日喀则市| 垣曲县| 鹤壁市| 阳曲县| 临清市| 德阳市| 扶风县| 江孜县| 铜梁县| 彭山县| 登封市| 长垣县|