Goingmm

            BlogJava :: 首頁(yè) :: 新隨筆 ::  :: 聚合  :: 管理 ::
            82 隨筆 :: 15 文章 :: 452 評(píng)論 :: 0 Trackbacks

          ------------------------------------------------------------------------------------------------
             Eclipse Platform
          Version: 3.1.0 Build id: I20050219-1500

             
            Junit Version:
          3.8.1

          ------------------------------------------------------------------------------------------------

          EclipseJunit 大家應(yīng)該都很熟悉了。這里我也不打算去講為什么需要做這樣的組合。為什么需要測(cè)試。為什么測(cè)試還有那么多講究和學(xué)問(wèn)。用一個(gè)最簡(jiǎn)單的例子,讓還沒(méi)有使用過(guò)的朋友,有一個(gè)簡(jiǎn)單的認(rèn)識(shí)。主要是發(fā)圖玩玩

           

          1)看看完成后的效果圖
          Project.JPG

          2)      
          運(yùn)行Eclipse。新建一個(gè)workplace項(xiàng)目,點(diǎn)擊 file->new->project,選擇Java項(xiàng)目,點(diǎn)擊下一步。寫一個(gè)項(xiàng)目名稱,例如UseJUnit。點(diǎn)擊Finish。這樣就完成新項(xiàng)目的建立。再來(lái)配置一下Eclipse,在構(gòu)建路徑中添加JUnit類庫(kù)。在工具條上點(diǎn)擊項(xiàng)目->屬性,選擇Java Build Path,Libraries,選擇 Add external JARs,瀏覽Junit被存儲(chǔ)的目錄,選擇junit.jar,點(diǎn)擊打開(kāi)。你將會(huì)看見(jiàn)JUnit出現(xiàn)在庫(kù)的列表中。點(diǎn)擊確定,讓Eclipse重建路徑。
          addJar.JPG

                   

          3)新建一個(gè)Class Person
          Person.JPG

          4) 新建一個(gè)Test Class TestCaseWithJunit
          newJunit.JPG

          代碼如下:public void testSay() 方法是我自己加進(jìn)去的

          TestCaseWithJunit.JPG

          5) Run Test case
             runJunit.JPG

          6) 看看測(cè)試結(jié)果
                result-1.JPG

          7)修改一下測(cè)試代碼
             modifiedcode.JPG

          8)再看測(cè)試結(jié)果
          result-2.JPG

          result-3.JPG



          呵呵! 第一次發(fā)圖。如果上面的過(guò)程描述有什么不清楚的地方。請(qǐng)與我聯(lián)系

          2005-11-13  聽(tīng)濤 窗臺(tái)


          posted on 2005-11-13 13:45 Goingmm 閱讀(389) 評(píng)論(1)  編輯  收藏 所屬分類: Reading Note

          評(píng)論

          # re: Eclipse + Junit 2005-11-13 14:28 _
          這個(gè) blog 居然會(huì)這樣:

          Server Error in '/' Application.
          --------------------------------------------------------------------------------

          Runtime Error
          Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

          Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


          <!-- Web.Config Configuration File -->

          <configuration>
          <system.web>
          <customErrors mode="Off"/>
          </system.web>
          </configuration>


          Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


          <!-- Web.Config Configuration File -->

          <configuration>
          <system.web>
          <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
          </system.web>
          </configuration>

            回復(fù)  更多評(píng)論
            

          主站蜘蛛池模板: 深泽县| 西乌珠穆沁旗| 浮山县| 武穴市| 阜新市| 龙井市| 汉寿县| 西昌市| 西乌| 阿拉尔市| 永清县| 清原| 沙田区| 平利县| 深水埗区| 英超| 于都县| 和林格尔县| 友谊县| 东城区| 格尔木市| 屯昌县| 星子县| 任丘市| 晴隆县| 重庆市| 文成县| 勐海县| 休宁县| 仲巴县| 遂平县| 蓝田县| 安达市| 邛崃市| 盐城市| 雷山县| 天气| 商都县| 乌拉特前旗| 浠水县| 江油市|