Usage Example

Distribution from a library and some third-party dependencies

In this example a plugin distribution is created for the artifact company.jameica.plugin:library and the third party artifact other.dependency:some-name.

A distribution consists of the given dependencies including all transitive runtime dependencies. By this all test, provided and system scoped dependencies are excluded.

<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/maven-v4_0_0.xsd"
>
        <modelVersion>4.0.0</modelVersion>
        ...
        <dependencies>
                ...
                <dependency>
                        <groupId>de.esw.jameica.ui.test</groupId>
                        <artifactId>junit4-jameica-ui-test</artifactId>
                        <version>1.0.0-SNAPSHOT</version>
                        <scope>test</scope>
                </dependency>
        </dependencies>
        <build>
                <plugins>
                        <plugin>
                                <groupId>de.esw.maven.plugin</groupId>
                                <artifactId>maven-jameica-test-plugin</artifactId>
                                <version>1.0.0-SNAPSHOT</version>
                                <configuration>
                                        <jameicaUrl>file://C:/jameica.zip</jameicaUrl>
                                        <plugins>
                                                <plugin>file://C:/someplugin.zip</plugin>
                                        </plugins>
                                </configuration>
                                <executions>
                                        <execution>
                                                <phase>test-compile</phase>
                                                <goals>
                                                        <goal>package-jameica-tests</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>
</project>

The configuration requires that the file C:/jameica.zip is available in the local files system. Instead any valid URL could be specified (http://..., https://..., ftp://...).

The test case must be annotated with the JameicaTestRunner so JUnit4 is made aware of the alternative execution process. For an example see below:

@RunWith(JameicaTestRunner.class)
public class JameicaTestCase {

        @Test
        public void testMe() {
                // add some assertions here
        }
        
}

During the surefire execution a jameica installation is created in a temporary file location. The specified plugins and dependencies are deployed in this instance. Afterwards jameica is started and the tests are executed.

The test results are ordinary JUnit4 reports, therefore it is fully compatible with the surefire reporter. You can as well use cobertura for coverate testing.

The plugin could possible run without maven.