<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    成就夢(mèng)想

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      21 隨筆 :: 22 文章 :: 6 評(píng)論 :: 0 Trackbacks
            web應(yīng)用集成測(cè)試的時(shí)候,各位還需要啟動(dòng)web容器,然后打開瀏覽器,輸入ulr,然后看到瀏覽器的輸出嗎?

    下面我們用maven做到自動(dòng)化!


     

    我們利用maven的生命周期和jetty插件來實(shí)現(xiàn)。

     

    下面描述下做的自動(dòng)化web集成測(cè)試實(shí)現(xiàn)的原理。

    1,在生命周期pre-integration-test啟動(dòng)jetty容器

    2,在生命周期integration-test中測(cè)試我們寫的***IT.java類

    3,在post-integration-test shutdow jetty容器。

    在pom.xml中加入代碼如下:

    <profiles>
            
    <profile>
                
    <id>ittest</id>
                
    <build>
                    
    <plugins>
                        
    <plugin>
                            
    <groupId>org.apache.maven.plugins</groupId>
                            
    <artifactId>maven-surefire-plugin</artifactId>
                            
    <executions>
                                
    <execution>
                                    
    <id>run-integration-test</id>
                                    
    <phase>integration-test</phase>
                                    
    <goals>
                                        
    <goal>test</goal>
                                    
    </goals>
                                    
    <configuration>
                                        
    <includes>
                                            
    <include>**/*IT.java</include>
                                        </includes>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.mortbay.jetty</groupId>
                            <artifactId>maven-jetty-plugin</artifactId>
                            <version>6.1.26</version>
                            <configuration>
                                <contextPath>/</contextPath>
                                <stopPort>9966</stopPort>
                                <stopKey>stop-jetty-for-it</stopKey>
                                <connectors>
                                    <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                        <port>6211</port>
                                    </connector>
                                </connectors>
                            </configuration>

                            <executions>
                                <execution>
                                    <id>start-it-jetty</id>
                                    <phase>pre-integration-test</phase>
                                    <goals>
                                        <goal>run</goal>
                                    </goals>
                                    <configuration>
                                        <daemon>true</daemon>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>stop-it-jetty</id>
                                    <phase>post-integration-test</phase>
                                    <goals>
                                        <goal>stop</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>

     

    然后就可以編寫測(cè)試用例了

     

     步驟如下:

    1,定義一個(gè)以此命名的****IT的測(cè)試類(integration test縮寫), 在里面華麗的寫好你的測(cè)試邏輯。

    再此不舉例了,主要一個(gè)思路可以用httpclint來實(shí)現(xiàn)里面的測(cè)試代碼。

    2,然后 執(zhí)行 mvn clean post-integration-test -Pittest

    好了 就可以看到我們測(cè)試用例是否通過。

    建議:以上的代碼可以加入到父類的pom中,以后繼承此父pom后,只需要按以上2步,就可以做到web應(yīng)用測(cè)試自動(dòng)化了。

     



    posted on 2012-04-21 11:57 iamct 閱讀(3113) 評(píng)論(0)  編輯  收藏 所屬分類: 項(xiàng)目管理

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 国产亚洲美女精品久久久| 一级特黄aa毛片免费观看| 污视频在线免费观看| 亚洲国产日产无码精品| 老司机精品免费视频| 国产三级电影免费观看| 国产成+人+综合+亚洲专| 久久99国产综合精品免费| 久久久久亚洲爆乳少妇无| 亚洲视频在线免费播放| 亚洲人成综合在线播放| 亚洲精品成a人在线观看| 视频一区在线免费观看| 日韩免费福利视频| 亚洲欧美成aⅴ人在线观看| a毛片基地免费全部视频| 色老板亚洲视频免在线观| 亚洲熟伦熟女新五十路熟妇| 一边摸一边桶一边脱免费视频| 亚洲高清无码专区视频| 九一在线完整视频免费观看| 亚洲毛片免费视频| 午夜免费福利在线| 国产亚洲精品美女久久久久| 亚洲AⅤ无码一区二区三区在线 | 国产在线观看免费视频软件| 亚洲级αV无码毛片久久精品| 在线观看肉片AV网站免费| 激情小说亚洲色图| 国产亚洲精品看片在线观看| 在线jyzzjyzz免费视频| 又硬又粗又长又爽免费看| 精品亚洲综合在线第一区| 99国产精品视频免费观看| 亚洲AV无码无限在线观看不卡| 国产成人免费A在线视频| 999zyz**站免费毛片| wwwxxx亚洲| 亚洲色图古典武侠| 国产无遮挡吃胸膜奶免费看| 37pao成人国产永久免费视频|