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

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

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

    qileilove

    blog已經(jīng)轉(zhuǎn)移至github,大家請訪問 http://qaseven.github.io/

    1. MAVEN + SVN + HUDSON + SONAR集成測試環(huán)境搭建、

    1. MAVEN + SVN + HUDSON + SONAR集成測試環(huán)境搭建、
      1.1 軟件準備
      Hudson、Jenkins、Sonar
      1.2 軟件安裝
      說明:本例均使用將應(yīng)用程序部署至web容器下,Hudson和Sonar有其他部署啟動方式,如有需要請自行使用,本文不做贅述。
      1.2.1 安裝hudson
      1)將下載到的hudson.war文件部署至web容器中,啟動web容器。
      2)訪問地址http://localhost:8080/hudson,顯示如下:
      (8080是容器默認端口,hudson是項目名稱)
      1.2.2 安裝sonar
      說明:以下內(nèi)容是快速安裝的示例。
      1)解壓sonar.zip,進入war文件夾下,運行build-war文件,會生成sonar.war文件
      2)將sonar.war文件部署至web容器下,啟動容器
      3)訪問地址http://localhost:8080/sonar/,顯示如下:
      4)(8080是容器默認端口,sonar是項目名稱)
      1.3 軟件配置
      1.3.1 配置sonar
      1)創(chuàng)建數(shù)據(jù)庫
      a)Sonar需要數(shù)據(jù)庫的支持,其本身自帶Derby同時支持MySQL5.x,Oracle 10g XE,Postgresql和MS SqlServer 2005,推薦使用MySQL。
      b)創(chuàng)建數(shù)據(jù)庫:MySQL中創(chuàng)建用戶sonar,同時創(chuàng)建數(shù)據(jù)庫sonar,未用戶sonar賦予權(quán)限。
      說明:表和索引活在sonar激活后自動創(chuàng)建。
      2)配置數(shù)據(jù)庫,編輯conf/sonar.properties
    sonar.jdbc.username: sonar
    sonar.jdbc.password: sonar
    sonar.jdbc.url:     jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
    sonar.jdbc.driverClassName:com.mysql.jdbc.Driver
      說明:更改數(shù)據(jù)庫配置,請注意extensions/jdbc-driver/mysql/目錄下是否有對應(yīng)的驅(qū)動
      1.3.2 配置hudson
      請保證Hudson已經(jīng)安裝以下插件:
      進入Manage Hudson ->Config System進行配置,顯示如下:
      1)系統(tǒng)信息配置:
      Home directory:hudson目錄
      System Message:hudson系統(tǒng)說明信息
      # of executors:同時可執(zhí)行最大數(shù)
      Quiet period:構(gòu)建工程之前的等候時間,單位是s,此項較重要可以保證構(gòu)建工程時項目的完整性
      SCM checkout retry count:檢出失敗重試次數(shù)2)安全信息配置:
      3)JDK配置:
      如果系統(tǒng)配置已為JDK配置了環(huán)境變量,則此處可以不做設(shè)置
      4)Maven配置:
      Name:為你的maven指定名稱
      MAVEN_HOME:指定maven安裝路徑
      5)SVN配置:
      Exclusion revprop name:指定項目SVN路徑
      1.4 環(huán)境集成
      1.4.1 Maven與Sonar集成
      編輯$MAVEN_HOME/conf或者~/.m2下的setting.xml文件,添加如下內(nèi)容:
    <!--sonar -->
    <profile>
    <id>sonar</id>
    <activation>
    <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
    <!-- mysql-->
    <sonar.jdbc.url> jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
    </sonar.jdbc.url>
    <sonar.jdbc.driver> com.mysql.jdbc.Driver</sonar.jdbc.driver>
    <sonar.jdbc.username>sonar</sonar.jdbc.username>
    <sonar.jdbc.password>sonar</sonar.jdbc.password>
    <!--remote host-->
    <sonar.host.url>http://localhost:8080/sonar</sonar.host.url>
    </properties>
    </profile>
      說明: 因為sonar是通過Maven2插件來分析源代碼并把結(jié)果注入到數(shù)據(jù)庫的,所以必須在Maven的配置里設(shè)置數(shù)據(jù)庫的屬性。
      1.4.2 hudson與sonar集成
      1)安裝sonar插件
      2)配置Sonar參數(shù)(服務(wù)地址和數(shù)據(jù)庫地址)
      1.5 創(chuàng)建和配置job
      1.5.1 創(chuàng)建JOB,點擊New Job,顯示如下:
      1.5.2 點擊OK,顯示如下:
      1)工程概要配置:
      2)工程高級配置:
      3)源碼管理:
      高級配置:
      4)構(gòu)建
      2.Eclipse中IDE環(huán)境下集成測試
      說明:在IDE環(huán)境下集成測試非常方便,可以使用的組件有dashboard、cobertura、findbugs
      2.1   Findbugs:根據(jù)既定規(guī)則檢查代碼bug
      1)修改工程的pom.xml文件,添加findbugs-maven-plugin插件
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
    <threshold>High</threshold>
    <effort>Default</effort>
    <findbugsXmlOutput>true</findbugsXmlOutput>
    <!-- findbugs xml輸出路徑-->        <findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
    </configuration>
    </plugin>
      2)輸入命令:
      mvn findbugs:findbugs
      3)結(jié)果會生成在target/目錄下findbugsXml.xml文件中
      2.2 Cobertura:測試覆蓋率插件
      1)修改工程的pom.xml文件,添加cobertura-maven-plugin插件
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.5.1</version>
    </plugin>
      2)輸入命令:
      mvn cobertura:cobertura
      3)結(jié)果生成在target/site/cobertura目錄下
      2.3   Dashboard:圖表顯示測試結(jié)果
      1)修改工程的pom.xml文件,添加dashboard-maven-plugin插件
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>dashboard-maven-plugin</artifactId>
    <version>1.0.0-beta-1</version>
    </plugin>
      2)輸入命令:
    mvn site
    mvn dashboard:dashboard
      3)在項目targe/site目錄下打開dashboard頁面查看結(jié)果
      如果安裝了dashboard插件,可以在dashaboard文件中查看所有測試結(jié)果信息。

    posted on 2014-03-12 10:48 順其自然EVO 閱讀(1364) 評論(0)  編輯  收藏 所屬分類: 持續(xù)集成 、maven

    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(55)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲图片激情小说| 亚洲精品无码专区在线在线播放 | 国产精品永久免费| 亚洲人成影院77777| 日本一区二区在线免费观看| 无码AV片在线观看免费| 亚洲人成77777在线播放网站| 美女被免费网站91色| 亚洲午夜久久久影院| 国内少妇偷人精品视频免费| 亚洲爆乳无码专区| 中文字幕成人免费视频| 亚洲六月丁香六月婷婷蜜芽| 成人免费福利电影| 狠狠热精品免费观看| 久久久久久亚洲精品不卡| 亚洲成人福利在线观看| 成人女人A级毛片免费软件| 亚洲日韩精品无码专区加勒比| 中文字幕a∨在线乱码免费看| 亚洲午夜爱爱香蕉片| 亚洲精品无播放器在线播放 | 妞干网在线免费视频| 亚洲VA中文字幕无码毛片| 日本xxxx色视频在线观看免费| 亚洲国产片在线观看| 国产成人精品123区免费视频| 亚洲精品视频在线播放| 女人张腿给男人桶视频免费版 | 国产免费高清69式视频在线观看| 亚洲av永久无码精品网站| 国产精品1024永久免费视频| 亚洲av永久无码制服河南实里| 免费国产成人高清在线观看网站 | 亚洲精品无码你懂的网站| 久久精品国产这里是免费| 亚洲中文精品久久久久久不卡| 3344永久在线观看视频免费首页| 亚洲精品国产国语| 丁香花免费完整高清观看 | 久久亚洲AV成人无码国产最大|