2015-07-07 17 views
5

Dưới đây là hồ sơ tệp pom hương vị của tôi cho các bài kiểm tra đơn vị sản phẩm của tôi. chúng tôi có các bài kiểm tra trình cắm thêm junit. Các cấu hình tệp pom này không cho tôi tệp bảo hiểm mã jacoco (.exec) ở bất kỳ vị trí nào. hãy giúp tôi nếu có sai sót ở đâu. Cảm ơn bạnphạm vi mã cho các kiểm tra trình cắm thêm junit với maven

<profile> 
     <id>unit-tests</id> 
     <modules> 
      <module>../../../test/com.xxxx.tools.comms.test.utilities</module> 

      <!-- product related unit tests 
      <module>../../../test/com.xxxx.comms.product.test</module> 
      <module>../../../test/com.xxxx.comms.product.mas.test</module>--> 
      <module>../../../test/com.xxxx.comms.product.iv.test</module> 
     </modules> 

     <properties> 
      <!-- Properties to enable jacoco code coverage analysis --> 
      <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> 
      <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> 
     </properties> 

     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.jacoco</groupId> 
        <artifactId>jacoco-maven-plugin</artifactId> 
        <version>0.7.2.201409121644</version> 
        <configuration> 
         <!-- Where to put jacoco coverage report --> 
         <destFile>C:/Userdata/product/GIT/Team/coverage/product1/jacoco/12.exec</destFile> 
        </configuration> 
        <executions> 
         <execution> 
          <id>jacoco-initialize</id> 
          <goals> 
           <goal>prepare-agent</goal> 
          </goals> 

         </execution> 
         <execution> 
          <id>jacoco-site</id> 
          <phase>package</phase> 
          <goals> 
           <goal>report</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </build> 
    </profile> 


<build> 
     <plugins> 
      <!-- Use of Tycho --> 
      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>tycho-maven-plugin</artifactId> 
       <version>${tycho-version}</version> 
       <extensions>true</extensions> 
      </plugin> 

      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>tycho-surefire-plugin</artifactId> 
       <version>${tycho-version}</version> 
       <configuration> 
        <includes> 
         <include>**/Tests*.java,**/*Tests.java,**/*TestCase.java,**/Test*.java,**/*Test.java</include> 
        </includes> 
        <argLine>${argLine}</argLine> 
        <useUIHarness>true</useUIHarness> 
        <!-- Kill test JVM if tests take more than 1 minute to finish --> 
        <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds> 
        <testFailureIgnore>true</testFailureIgnore> 
       </configuration> 

      </plugin> 

      <!-- Configuration of target platforms --> 
      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>target-platform-configuration</artifactId> 
       <version>${tycho-version}</version> 
       <configuration> 
        <pomDependencies>consider</pomDependencies> 
        <resolver>p2</resolver> 
        <environments> 
         <environment> 
          <os>win32</os> 
          <ws>win32</ws> 
          <arch>x86</arch> 
         </environment> 
        </environments> 
       </configuration> 
      </plugin> 

     </plugins> 

     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.eclipse.tycho</groupId> 
        <artifactId>tycho-packaging-plugin</artifactId> 
        <version>${tycho-version}</version> 
        <configuration> 
         <!-- workaround for TYCHO-349 or TYCHO-313 --> 
         <strictVersions>false</strictVersions> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.eclipse.tycho</groupId> 
        <artifactId>tycho-compiler-plugin</artifactId> 
        <version>${tycho-version}</version> 
        <configuration> 
         <source>${jdk.version}</source> 
         <target>${jdk.version}</target> 
        </configuration> 
       </plugin> 

      </plugins> 
     </pluginManagement> 
    </build> 
+0

Cấu hình chắc chắn của bạn là gì? Bạn phải cấu hình chắc chắn để ngã ba để cho phép các đại lý jacoco. – SpaceTrucker

+0

hãy tìm cấu hình plugin của tôi được thêm ở trên. Nhưng tôi thấy rằng theo mặc định ngã ba là đúng và forkCount = 1 –

+0

Thủ phạm chính là sử dụng tycho-surefire pugin tôi nghĩ. Có một số thông tin về điều này trên mạng, nhưng nó có vẻ luôn luôn là rất nhiều không quan trọng. Bạn có thể xem xét những điều sau: https://intellectualcramps.wordpress.com/2012/03/22/jacoco-tycho-and-coverage-reports/, http://stackoverflow.com/questions/8944223/how-do -i-make-jenkins-sonar-và-the-jacoco-plugin-work-cùng-cho-eclipse-tyc, http://mdwhatever.free.fr/index.php/2011/09/quality-analysis-on -eclipse-plugins-với-tycho-sonar-jacoco-và-swtbot /, https://github.com/SonarSource/sonar-examples/tree/master/projects/tycho – SpaceTrucker

Trả lời

1

Tôi đã nhận được sự cố.
Thủ phạm là thông số <argLine> trong cấu hình tycho-surefire-plugin.
Nếu tham số này hiện diện, tệp jacoco không được tạo. Tôi đã xóa nó và bây giờ tập tin .exec được tạo ra.
Tìm hiểu thêm tại tycho-surefire argLine causes no jacaco.exec

Các vấn đề liên quan