<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,大家請(qǐng)?jiān)L問 http://qaseven.github.io/

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

    1. MAVEN + SVN + HUDSON + SONAR集成測(cè)試環(huán)境搭建、
      1.1 軟件準(zhǔn)備
      Hudson、Jenkins、Sonar
      1.2 軟件安裝
      說明:本例均使用將應(yīng)用程序部署至web容器下,Hudson和Sonar有其他部署啟動(dòng)方式,如有需要請(qǐng)自行使用,本文不做贅述。
      1.2.1 安裝hudson
      1)將下載到的hudson.war文件部署至web容器中,啟動(dòng)web容器。
      2)訪問地址http://localhost:8080/hudson,顯示如下:
      (8080是容器默認(rèn)端口,hudson是項(xiàng)目名稱)
      1.2.2 安裝sonar
      說明:以下內(nèi)容是快速安裝的示例。
      1)解壓sonar.zip,進(jìn)入war文件夾下,運(yùn)行build-war文件,會(huì)生成sonar.war文件
      2)將sonar.war文件部署至web容器下,啟動(dòng)容器
      3)訪問地址http://localhost:8080/sonar/,顯示如下:
      4)(8080是容器默認(rèn)端口,sonar是項(xiàng)目名稱)
      1.3 軟件配置
      1.3.1 配置sonar
      1)創(chuàng)建數(shù)據(jù)庫
      a)Sonar需要數(shù)據(jù)庫的支持,其本身自帶Derby同時(shí)支持MySQL5.x,Oracle 10g XE,Postgresql和MS SqlServer 2005,推薦使用MySQL
      b)創(chuàng)建數(shù)據(jù)庫:MySQL中創(chuàng)建用戶sonar,同時(shí)創(chuàng)建數(shù)據(jù)庫sonar,未用戶sonar賦予權(quán)限。
      說明:表和索引活在sonar激活后自動(dòng)創(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ù)庫配置,請(qǐng)注意extensions/jdbc-driver/mysql/目錄下是否有對(duì)應(yīng)的驅(qū)動(dòng)
      1.3.2 配置hudson
      請(qǐng)保證Hudson已經(jīng)安裝以下插件:
      進(jìn)入Manage Hudson ->Config System進(jìn)行配置,顯示如下:
      1)系統(tǒng)信息配置:
      Home directory:hudson目錄
      System Message:hudson系統(tǒng)說明信息
      # of executors:同時(shí)可執(zhí)行最大數(shù)
      Quiet period:構(gòu)建工程之前的等候時(shí)間,單位是s,此項(xiàng)較重要可以保證構(gòu)建工程時(shí)項(xiàng)目的完整性
      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:指定項(xiàng)目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>
      說明: 因?yàn)閟onar是通過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,點(diǎn)擊New Job,顯示如下:
      1.5.2 點(diǎn)擊OK,顯示如下:
      1)工程概要配置:
      2)工程高級(jí)配置:
      3)源碼管理:
      高級(jí)配置:
      4)構(gòu)建
      2.Eclipse中IDE環(huán)境下集成測(cè)試
      說明:在IDE環(huán)境下集成測(cè)試非常方便,可以使用的組件有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é)果會(huì)生成在target/目錄下findbugsXml.xml文件中
      2.2 Cobertura:測(cè)試覆蓋率插件
      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:圖表顯示測(cè)試結(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)在項(xiàng)目targe/site目錄下打開dashboard頁面查看結(jié)果
      如果安裝了dashboard插件,可以在dashaboard文件中查看所有測(cè)試結(jié)果信息。

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

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(55)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 一本色道久久88综合亚洲精品高清| 小说专区亚洲春色校园| 久久精品夜色噜噜亚洲A∨| 91久久成人免费| 中文在线免费看视频| 亚洲最大av资源站无码av网址| 国精无码欧精品亚洲一区| 国产精品免费视频一区| 最近2019中文字幕免费大全5| 特级毛片爽www免费版| 亚洲狠狠成人综合网| 久久亚洲sm情趣捆绑调教| 国产精品亚洲玖玖玖在线观看 | 成全高清视频免费观看| 久久久久国色av免费看 | 免费永久国产在线视频| 91香蕉视频免费| 在线美女免费观看网站h| av永久免费网站在线观看| 免费一区二区无码视频在线播放| 亚洲毛片基地4455ww| 中文字幕亚洲精品| 久久久久亚洲Av片无码v| 中文字幕亚洲无线码| 免费在线一级毛片| 国产不卡免费视频| 免费黄色大片网站| 国内外成人免费视频| 日韩一区二区a片免费观看| 国产91色综合久久免费| 50岁老女人的毛片免费观看| 国产成人AV片无码免费| 97国免费在线视频| a级毛片免费全部播放无码| 国产一级片免费看| 亚洲一区免费观看| 99视频精品全部免费观看| 一级毛片不卡片免费观看| 久久免费视频网站| 91香蕉国产线观看免费全集 | 亚洲人色大成年网站在线观看|