Test Resources Ignored

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Test Resources Ignored

softwareforums2013
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Test Resources Ignored

Julien HENRY
Hi,

You have to set sonar.phase to a Maven phase that will execute the build-helper plugin before SonarQube analysis.

Here sonar.phase=generate-test-sources should do the trick.

Regards,

Julien


2013/10/31 aaron blood <[hidden email]>
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"
 
 

Reply | Threaded
Open this post in threaded view
|

Re: Test Resources Ignored

softwareforums2013
Hi Julien,
 
Thank you for you reply and I am wondering can we have multiple <sonar.phase> tags
 
For example:
<sonar.phase>generate-sources</sonar.phase>
<sonar.phase>generate-test-sources</sonar.phase>
 


On Thu, Oct 31, 2013 at 12:49 AM, Julien HENRY <[hidden email]> wrote:
Hi,

You have to set sonar.phase to a Maven phase that will execute the build-helper plugin before SonarQube analysis.

Here sonar.phase=generate-test-sources should do the trick.

Regards,

Julien


2013/10/31 aaron blood <[hidden email]>
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"
 
 


Reply | Threaded
Open this post in threaded view
|

Re: Test Resources Ignored

Julien HENRY
There is no point running several phases. We are talking about Maven phase in a Maven lifecycle so running phase "generate-test-sources" means to run all phases up to "generate-test-sources" including "generate-sources".

Julien


2013/10/31 aaron blood <[hidden email]>
Hi Julien,
 
Thank you for you reply and I am wondering can we have multiple <sonar.phase> tags
 
For example:
<sonar.phase>generate-sources</sonar.phase>
<sonar.phase>generate-test-sources</sonar.phase>
 


On Thu, Oct 31, 2013 at 12:49 AM, Julien HENRY <[hidden email]> wrote:
Hi,

You have to set sonar.phase to a Maven phase that will execute the build-helper plugin before SonarQube analysis.

Here sonar.phase=generate-test-sources should do the trick.

Regards,

Julien


2013/10/31 aaron blood <[hidden email]>
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"
 
 



Reply | Threaded
Open this post in threaded view
|

Re: Test Resources Ignored

softwareforums2013
Hi again

The piece of code above is just my sample code for analysis. We have ant project and have source code and test source code in multiple folder. And in our current code we have sonar.phase = generate source.  So if I replace this with generate-test-source it should include both.


On Thursday, October 31, 2013, Julien HENRY wrote:
There is no point running several phases. We are talking about Maven phase in a Maven lifecycle so running phase "generate-test-sources" means to run all phases up to "generate-test-sources" including "generate-sources".

Julien


2013/10/31 aaron blood <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;softwareforums2013@gmail.com&#39;);" target="_blank">softwareforums2013@...>
Hi Julien,
 
Thank you for you reply and I am wondering can we have multiple <sonar.phase> tags
 
For example:
<sonar.phase>generate-sources</sonar.phase>
<sonar.phase>generate-test-sources</sonar.phase>
 


On Thu, Oct 31, 2013 at 12:49 AM, Julien HENRY <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;julien.henry@sonarsource.com&#39;);" target="_blank">julien.henry@...> wrote:
Hi,

You have to set sonar.phase to a Maven phase that will execute the build-helper plugin before SonarQube analysis.

Here sonar.phase=generate-test-sources should do the trick.

Regards,

Julien


2013/10/31 aaron blood <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;softwareforums2013@gmail.com&#39;);" target="_blank">softwareforums2013@...>
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"
 
 



Reply | Threaded
Open this post in threaded view
|

Re: Test Resources Ignored

softwareforums2013
gave me error during sonar analysis while only having <sonar.phase>generate-test-source</sonar.phase> but when I do sonar analysis with <sonar.phase>generate-source</sonar.phase>. It doesnt give me error but I am not able to see my code for test source.


On Thu, Oct 31, 2013 at 9:14 AM, aaron blood <[hidden email]> wrote:
Hi again

The piece of code above is just my sample code for analysis. We have ant project and have source code and test source code in multiple folder. And in our current code we have sonar.phase = generate source.  So if I replace this with generate-test-source it should include both.


On Thursday, October 31, 2013, Julien HENRY wrote:
There is no point running several phases. We are talking about Maven phase in a Maven lifecycle so running phase "generate-test-sources" means to run all phases up to "generate-test-sources" including "generate-sources".

Julien


2013/10/31 aaron blood <[hidden email]>
Hi Julien,
 
Thank you for you reply and I am wondering can we have multiple <sonar.phase> tags
 
For example:
<sonar.phase>generate-sources</sonar.phase>
<sonar.phase>generate-test-sources</sonar.phase>
 


On Thu, Oct 31, 2013 at 12:49 AM, Julien HENRY <[hidden email]> wrote:
Hi,

You have to set sonar.phase to a Maven phase that will execute the build-helper plugin before SonarQube analysis.

Here sonar.phase=generate-test-sources should do the trick.

Regards,

Julien


2013/10/31 aaron blood <[hidden email]>
I added build-helper-maven-plugin in my pom.xml file to have multiple test source directory.
 
Here is a snap shot of my pom.xml file
 
 <build>
 <sourceDirectory>src</sourceDirectory>
 <testSourceDirectory>mockito</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
       </plugin>
    <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
   <executions>
    <execution>
     <id>add-test-source</id>
     <phase>generate-test-sources</phase>
     <goals>
      <goal>add-test-source</goal>
     </goals>
     <configuration>
      <sources>
       <source>testNG</source>
      </sources>
     </configuration>
    </execution>
   </executions>
  </plugin>
 
    </plugins>
  </build>
 
After the sonary analysis was complete. The code coverage and unit test report was successful and got report from both test folder.
 
But when I tried clickin on source to see the source code for unit test, I was only able to test code source for  "<testSourceDirectory>mockito</testSourceDirectory>" but I was not able to see the test code source for " <source>testNG</source>"