I don't know if I understand something wrong. I' trying to get automatic unit testing to work in my project.
I made a Eclipse Plugin Project and converted it into a Maven Project. I made a JUnit test case class testing the only class in the project. I placed every code in the Maven way (i.e. src/main/java main code and src/test/java test code).
I placed the test class in src/test/java in a package called pluginmaventest.actions .
The test case automatically fails if started in Eclipse as a JUnit test.
I shared the project in a SVN repository and made a Jenkins job (Maven 2/3 project). I added the JUnit dependency to the pom.xml and all necessary tycho dependencies.
The project build is successful. Shouldn't it be failing because my JUnit test fails?
I tried
mvn clean install
and
mvn test
as goals. I even tried to use -Dtest=SomeClassTest
. The build never fails.
This obviously means that the unit test is neither compiled nor performed, doesn't it?
I'm just trying to get a grip with Jenkins, Sonar and unit tests. My momentary goal is to get unit tests running with Jenkins, and then try to get code analysis and test coverage running with Sonar, which is integrated into Jenkins. Is there a comprehensive and understandable tutorial or how-to on the web?
ADDENDUM:
Here is my whole project pom.xml. (without surefire maven didn't produce any output, either)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://
maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test.maven.plugin</groupId>
<artifactId>pluginmaventest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Bla</name>
<packaging>eclipse-plugin</packaging>
<properties>
<tycho-version>0.13.0</tycho-version>
</properties>
<repositories>
<repository>
<id>indigo</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/indigo/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<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>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
check your project setup against the working demo example with tests: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-demo/itp01