質問

私たちはmultiprojectいしているためCobertura試験の内容報告の一環としてmvnサイト。取得できますCoberturaの子どもの事ですが、誤報告0%、ものが見に行ったヒットによるユニット。

しmvn2.0.8.していました走行 mvn clean site, mvn clean site:stagemvn clean package site.ピックアップしました。試験は、表示に必ずうまくいくの報告(txt/xmlおよびサイトがあります。私を見落とさないようにします。なCobertura動作しないとmultiprojects?

この会はなかったようである。pom:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <inherited>true</inherited>
        </plugin>
    </plugins>
</reporting>

また走りでなく、次のように入力します。poms:

    <reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
        </plugin>
    </plugins>
</reporting>

を取得します出力の構築:

...
[INFO] [cobertura:instrument]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 3 files to C:\workspaces\sandbox\CommonJsf\target\generated-classes\cobertura
Cobertura: Saved information on 3 classes.
Instrument time: 186ms

[INFO] Instrumentation was successful.
...
[INFO] Generating "Cobertura Test Coverage" report.
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 3 classes.
Report time: 481ms

[INFO] Cobertura Report generation was successful.

また、同報告書は以下のようなものです:cobertura report

役に立ちましたか?

解決

思が欠落しているの執行coberturaプラグインのコンパイルの位相をコードだけを返し観測による報告のためのプラグインのサイトライフサイクルの試験をしました。での走行試験な拾っ走る以外のユーザコードです。解析ビルドログにはより慎重に-がん、などをお届けすることを必ずうまくいくの試験を行う前にcobertura:ます。

私の設定はこのようなもののほか、を指定するクリーンexectutionにpluginManagement(ようご)かを指定しcoberturaプラグインを明示的に構築のプラグイン部:

  <build>
  ...
    <plugins>
    ...
      <plugin>
        <inherited>true</inherited>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${cobertura.plugin.version}</version>
      </plugin>
    </plugins>
  </build>

私の設定新お疲作品は、すべてのCoberturaもののグローバルな企業グループ全pom、すべてのプロジェクトとしての利用が含まれます。

このように案件を指定しないCobertura関連そのpom.xml's"がスターを取材。

他のヒント

なんと成功を得Coberturaを報告からの多されました。この問題になっている総合マルチプロジェクト報告といいます。

しての評価 ソナー ソリューションとして弊社のメトリック報告といいます。いい仕事を提供する概要メトリクス支援を含むマルチproijects.

の解決策はあるので少しマニュアルです。での数段の一つであるステップを組み合わせます。serのファイルから生成されるCobertura.これを利用しておりますcobertura統合コマンドラインツール内のmavenの課題です。

に応じて出力するファイルを実際に観測で伝える3つのファイルを観測.

@マルコはできないのはそのために通常よりmavenローカルのmaven coberturaプラグインが欠けている合併の目標です。

とで実現できなコストダウンが期待でき混maven、ant目標 http://thomassundberg.wordpress.com/2012/02/18/test-coverage-in-a-multi-module-maven-project/

それにもかかわらず、また単一のプロジェクトundertestが不要にする必要がありません。でき、試験プロジェクトコピーします。serのファイルをユーザの授業プロジェクトからの下での試験

//in test project
<plugin> 
<groupId>com.github.goldin</groupId>
<artifactId>copy-maven-plugin</artifactId>
<version>0.2.5</version>
<executions>
    <execution>
    <id>copy-cobertura-data-from-project-under-test</id>
    <phase>compile</phase>
    <goals>
        <goal>copy</goal>
    </goals>
    <configuration>
    <resources>
        <resource>
                        <directory>${project.basedir}/../<project-under-test>/target/cobertura</directory>
                            <targetPath>${project.basedir}/target/cobertura</targetPath>
                <includes>                  
                              <include>*.ser</include>
                </includes>
           </resource>
           <resource>
                    <directory>${project.basedir}/../<project-under-test>/target/generated-classes/cobertura/</directory>
                    <targetPath>${project.basedir}/target/generated-classes/cobertura</targetPath>
                    <preservePath>true</preservePath>
           </resource>
        </resources>
            </configuration>
        </execution>
</executions>
</plugin>

//in parent project
<build>
<plugins>
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <configuration>
        <format>xml</format>
        <aggregate>true</aggregate>
    </configuration>
    <executions>
        <execution>
                    <goals>
                <goal>clean</goal>
            </goals>
        </execution>
    </executions>
</plugin>
    </plugins>
</build>
<reporting>
<plugins>
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>${cobertura.version}</version>
        </plugin>
</plugins>
 </reporting>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top