Fork me on GitHub

nar:nar-integration-test

Full name:

com.github.maven-nar:nar-maven-plugin:3.4.1-SNAPSHOT:nar-integration-test

Description:

Run integration tests using Surefire. This goal was copied from Maven's surefire plugin to accomodate a few things for the NAR plugin:

1. To test a jar file with its native module we can only run after the package phase, so we use the integration-test phase.

2. We need to set java.library.path to an AOL (architecture-os-linker) specific value, but AOL is only known in the NAR plugin and thus cannot be set from the pom.

3. To have the java.library.path definition picked up by java we need the "pertest" forkmode. To use this goal you need to put the test sources in the regular test directories but disable the running of the tests by the maven-surefire-plugin by setting maven.test.skip.exec to false in your pom.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • Binds by default to the lifecycle phase: integration-test.

Required Parameters

Name Type Since Description
basedir File - The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir").
User property is: basedir.
classesDirectory File - The directory containing generated classes of the project being tested.
User property is: project.build.outputDirectory.
layout String - Layout to be used for building and unpacking artifacts
Default value is: com.github.maven_nar.NarLayout21.
User property is: nar.layout.
testClassesDirectory File - The directory containing generated test classes of the project being tested.
User property is: project.build.testOutputDirectory.
testSourceDirectory File 2.2 The test source directory containing test class sources.
User property is: project.build.testSourceDirectory.

Optional Parameters

Name Type Since Description
additionalClasspathElements List 2.4 Additional elements to be appended to the classpath.
aol String - Architecture-OS-Linker name. Defaults to: arch-os-linker.
architecture String - The Architecture for the nar, Some choices are: "x86", "i386", "amd64", "ppc", "sparc", ... Defaults to a derived value from ${os.arch}
User property is: nar.arch.
argLine String 2.1 Arbitrary JVM options to set on the command line.
User property is: argLine.
childDelegation boolean 2.1 When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not "none").
Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.
User property is: childDelegation.
classifiers List - List of classifiers which you want download/unpack/assemble Example ppc-MacOSX-g++, x86-Windows-msvc, i386-Linux-g++. Not setting means all.
debugForkedProcess String 2.4 Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified in the argLine).
User property is: maven.surefire.debug.
disableXmlReport boolean 2.2 Flag to disable the generation of report files in xml format.
User property is: disableXmlReport.
enableAssertions boolean 2.3.1 By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set this flag to false.
Default value is: true.
User property is: enableAssertions.
environmentVariables Map 2.1.3 Additional environments to set on the command line.
excludeArtifactIds String 2.0 Comma separated list of Artifact names to exclude.
User property is: excludeArtifactIds.
excludeGroupIds String 2.0 Comma separated list of GroupId Names to exclude.
User property is: excludeGroupIds.
excludedGroups String 2.2 (TestNG only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run. This parameter is overridden if suiteXmlFiles are specified.
User property is: excludedGroups.
excludes List - List of patterns (separated by commas) used to specify the tests that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be **/*$* (which excludes all inner classes). This parameter is ignored if TestNG suiteXmlFiles are specified.
failIfNoTests Boolean 2.4 Set this to "true" to cause a failure if there are no tests to run. Defaults to false.
User property is: failIfNoTests.
forkMode String 2.1 Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted for backwards compatibility.
Default value is: once.
User property is: forkMode.
forkedProcessTimeoutInSeconds int 2.4 Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.
User property is: surefire.timeout.
groups String 2.2 (TestNG only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified. This parameter is overridden if suiteXmlFiles are specified.
User property is: groups.
ignore boolean - Ignore errors and failures.
Default value is: false.
User property is: nar.ignore.
includeArtifactIds String 2.0 Comma separated list of Artifact names to include.
User property is: includeArtifactIds.
includeGroupIds String 2.0 Comma separated list of GroupIds to include.
User property is: includeGroupIds.
includes List - List of patterns (separated by commas) used to specify the tests that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be **/Test*.java **/*Test.java **/*TestCase.java. This parameter is ignored if TestNG suiteXmlFiles are specified.
javah Javah - Javah info
junitArtifactName String 2.3.1 Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used.
Default value is: junit:junit.
User property is: junitArtifactName.
jvm String 2.1 Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be the same as the one used to run Maven.
User property is: jvm.
libraries List - List of libraries to create
libsName String - Name of the libraries included
linker Linker - Linker
msvc Msvc - (no description)
os String - The Operating System for the nar. Some choices are: "Windows", "Linux", "MacOSX", "SunOS", ... Defaults to a derived value from ${os.name} FIXME table missing
User property is: nar.os.
output String - Name of the output - for jni default-value="${project.artifactId}-${project.version}" - for libs default-value="${project.artifactId}-${project.version}" - for exe default-value="${project.artifactId}" -- for tests default-value="${test.name}"
parallel String 2.2 (TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.
User property is: parallel.
printSummary boolean - Option to print summary of test suites or just print the test cases that has errors.
Default value is: true.
User property is: surefire.printSummary.
properties Properties - List of properties for configuring all TestNG related configurations. This is the new preferred method of configuring TestNG.
redirectTestOutputToFile boolean 2.3 When forking, set this to true to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).
User property is: nar.test.redirectTestOutputToFile.
reportFormat String - Selects the formatting for the test report to be generated. Can be set as brief or plain.
Default value is: brief.
User property is: surefire.reportFormat.
reportsDirectory File - Base directory where all reports are written to.
Default value is: ${project.build.directory}/surefire-reports.
skip boolean - Skip running of NAR plugins (any) altogether.
Default value is: false.
User property is: nar.skip.
skipNar boolean - Skip running of NAR integration test plugin
User property is: skipNar.
skipNarExec boolean 2.3 DEPRECATED This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec. Use -DskipTests instead; it's shorter.
User property is: nar.test.skip.exec.
skipNarTests boolean 2.4 Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
User property is: skipNarTests.
skipTests boolean - Skip the tests. Listens to Maven's general 'maven.skip.test'.
User property is: maven.test.skip.
suiteXmlFiles File[] 2.2 (TestNG only) List of TestNG suite xml file locations, seperated by commas. Note that suiteXmlFiles is incompatible with several other parameters on this plugin, like includes/excludes. This parameter is ignored if the "test" parameter is specified (allowing you to run a single test instead of an entire suite).
systemProperties Properties - List of System properties to pass to the JUnit tests.
targetDirectory File - Target directory for Nar file construction. Defaults to "${project.build.directory}/nar" for "nar-compile" goal
test String - Specify this parameter to run individual tests by file name, overriding the includes/excludes parameters. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type "-Dtest=MyTest" to run a single test called "foo/MyTest.java". This parameter will override the TestNG suiteXmlFiles parameter.
User property is: test.
testFailureIgnore boolean - Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
User property is: nar.test.failure.ignore.
testNGArtifactName String 2.3.1 Allows you to specify the name of the TestNG artifact. If not set, org.testng:testng will be used.
Default value is: org.testng:testng.
User property is: testNGArtifactName.
testTargetDirectory File - Target directory for Nar test construction. Defaults to "${project.build.directory}/test-nar" for "nar-testCompile" goal
testUnpackDirectory File - Target directory for Nar test unpacking. Defaults to "${testTargetDirectory}"
threadCount int 2.2 (TestNG only) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with parallel.
User property is: threadCount.
trimStackTrace boolean 2.2 Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
Default value is: true.
User property is: trimStackTrace.
unpackDirectory File - Target directory for Nar file unpacking. Defaults to "${targetDirectory}"
useFile boolean - Option to generate a file test report or just output the test report to the console.
Default value is: true.
User property is: surefire.useFile.
useManifestOnlyJar boolean 2.4.3 By default, Surefire forks your tests using a manifest-only jar; set this parameter to "false" to force it to launch your tests with a plain old Java classpath. (See http://maven.apache.org/plugins/maven-surefire-plugin/examples/class- loading.html for a more detailed explanation of manifest-only jars and their benefits.) Default value is "true". Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
Default value is: true.
User property is: surefire.useManifestOnlyJar.
useSystemClassLoader Boolean 2.3 Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's classloader. Default value is "true".
User property is: surefire.useSystemClassLoader.
workingDirectory File 2.1.3 Command line working directory.
User property is: basedir.

Parameter Details

additionalClasspathElements:

Additional elements to be appended to the classpath.
  • Type: java.util.List
  • Since: 2.4
  • Required: No

aol:

Architecture-OS-Linker name. Defaults to: arch-os-linker.
  • Type: java.lang.String
  • Required: No

architecture:

The Architecture for the nar, Some choices are: "x86", "i386", "amd64", "ppc", "sparc", ... Defaults to a derived value from ${os.arch}
  • Type: java.lang.String
  • Required: No
  • User Property: nar.arch

argLine:

Arbitrary JVM options to set on the command line.
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: argLine

basedir:

The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir").
  • Type: java.io.File
  • Required: Yes
  • User Property: basedir

childDelegation:

When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not "none").
Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.
  • Type: boolean
  • Since: 2.1
  • Required: No
  • User Property: childDelegation

classesDirectory:

The directory containing generated classes of the project being tested.
  • Type: java.io.File
  • Required: Yes
  • User Property: project.build.outputDirectory

classifiers:

List of classifiers which you want download/unpack/assemble Example ppc-MacOSX-g++, x86-Windows-msvc, i386-Linux-g++. Not setting means all.
  • Type: java.util.List
  • Required: No

debugForkedProcess:

Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified in the argLine).
  • Type: java.lang.String
  • Since: 2.4
  • Required: No
  • User Property: maven.surefire.debug

disableXmlReport:

Flag to disable the generation of report files in xml format.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: disableXmlReport

enableAssertions:

By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set this flag to false.
  • Type: boolean
  • Since: 2.3.1
  • Required: No
  • User Property: enableAssertions
  • Default: true

environmentVariables:

Additional environments to set on the command line.
  • Type: java.util.Map
  • Since: 2.1.3
  • Required: No

excludeArtifactIds:

Comma separated list of Artifact names to exclude.
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: excludeArtifactIds

excludeGroupIds:

Comma separated list of GroupId Names to exclude.
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: excludeGroupIds

excludedGroups:

(TestNG only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run. This parameter is overridden if suiteXmlFiles are specified.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • User Property: excludedGroups

excludes:

List of patterns (separated by commas) used to specify the tests that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be **/*$* (which excludes all inner classes). This parameter is ignored if TestNG suiteXmlFiles are specified.
  • Type: java.util.List
  • Required: No

failIfNoTests:

Set this to "true" to cause a failure if there are no tests to run. Defaults to false.
  • Type: java.lang.Boolean
  • Since: 2.4
  • Required: No
  • User Property: failIfNoTests

forkMode:

Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted for backwards compatibility.
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: forkMode
  • Default: once

forkedProcessTimeoutInSeconds:

Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.
  • Type: int
  • Since: 2.4
  • Required: No
  • User Property: surefire.timeout

groups:

(TestNG only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified. This parameter is overridden if suiteXmlFiles are specified.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • User Property: groups

ignore:

Ignore errors and failures.
  • Type: boolean
  • Required: No
  • User Property: nar.ignore
  • Default: false

includeArtifactIds:

Comma separated list of Artifact names to include.
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: includeArtifactIds

includeGroupIds:

Comma separated list of GroupIds to include.
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: includeGroupIds

includes:

List of patterns (separated by commas) used to specify the tests that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be **/Test*.java **/*Test.java **/*TestCase.java. This parameter is ignored if TestNG suiteXmlFiles are specified.
  • Type: java.util.List
  • Required: No

javah:

Javah info
  • Type: com.github.maven_nar.Javah
  • Required: No

junitArtifactName:

Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used.
  • Type: java.lang.String
  • Since: 2.3.1
  • Required: No
  • User Property: junitArtifactName
  • Default: junit:junit

jvm:

Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be the same as the one used to run Maven.
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: jvm

layout:

Layout to be used for building and unpacking artifacts
  • Type: java.lang.String
  • Required: Yes
  • User Property: nar.layout
  • Default: com.github.maven_nar.NarLayout21

libraries:

List of libraries to create
  • Type: java.util.List
  • Required: No

libsName:

Name of the libraries included
  • Type: java.lang.String
  • Required: No

linker:

Linker
  • Type: com.github.maven_nar.Linker
  • Required: No

msvc:

(no description)
  • Type: com.github.maven_nar.Msvc
  • Required: No

os:

The Operating System for the nar. Some choices are: "Windows", "Linux", "MacOSX", "SunOS", ... Defaults to a derived value from ${os.name} FIXME table missing
  • Type: java.lang.String
  • Required: No
  • User Property: nar.os

output:

Name of the output - for jni default-value="${project.artifactId}-${project.version}" - for libs default-value="${project.artifactId}-${project.version}" - for exe default-value="${project.artifactId}" -- for tests default-value="${test.name}"
  • Type: java.lang.String
  • Required: No

parallel:

(TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • User Property: parallel

printSummary:

Option to print summary of test suites or just print the test cases that has errors.
  • Type: boolean
  • Required: No
  • User Property: surefire.printSummary
  • Default: true

properties:

List of properties for configuring all TestNG related configurations. This is the new preferred method of configuring TestNG.
  • Type: java.util.Properties
  • Required: No

redirectTestOutputToFile:

When forking, set this to true to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).
  • Type: boolean
  • Since: 2.3
  • Required: No
  • User Property: nar.test.redirectTestOutputToFile

reportFormat:

Selects the formatting for the test report to be generated. Can be set as brief or plain.
  • Type: java.lang.String
  • Required: No
  • User Property: surefire.reportFormat
  • Default: brief

reportsDirectory:

Base directory where all reports are written to.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/surefire-reports

skip:

Skip running of NAR plugins (any) altogether.
  • Type: boolean
  • Required: No
  • User Property: nar.skip
  • Default: false

skipNar:

Skip running of NAR integration test plugin
  • Type: boolean
  • Required: No
  • User Property: skipNar

skipNarExec:

DEPRECATED This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec. Use -DskipTests instead; it's shorter.
  • Type: boolean
  • Since: 2.3
  • Required: No
  • User Property: nar.test.skip.exec

skipNarTests:

Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Since: 2.4
  • Required: No
  • User Property: skipNarTests

skipTests:

Skip the tests. Listens to Maven's general 'maven.skip.test'.
  • Type: boolean
  • Required: No
  • User Property: maven.test.skip

suiteXmlFiles:

(TestNG only) List of TestNG suite xml file locations, seperated by commas. Note that suiteXmlFiles is incompatible with several other parameters on this plugin, like includes/excludes. This parameter is ignored if the "test" parameter is specified (allowing you to run a single test instead of an entire suite).
  • Type: java.io.File[]
  • Since: 2.2
  • Required: No

systemProperties:

List of System properties to pass to the JUnit tests.
  • Type: java.util.Properties
  • Required: No

targetDirectory:

Target directory for Nar file construction. Defaults to "${project.build.directory}/nar" for "nar-compile" goal
  • Type: java.io.File
  • Required: No

test:

Specify this parameter to run individual tests by file name, overriding the includes/excludes parameters. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type "-Dtest=MyTest" to run a single test called "foo/MyTest.java". This parameter will override the TestNG suiteXmlFiles parameter.
  • Type: java.lang.String
  • Required: No
  • User Property: test

testClassesDirectory:

The directory containing generated test classes of the project being tested.
  • Type: java.io.File
  • Required: Yes
  • User Property: project.build.testOutputDirectory

testFailureIgnore:

Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • User Property: nar.test.failure.ignore

testNGArtifactName:

Allows you to specify the name of the TestNG artifact. If not set, org.testng:testng will be used.
  • Type: java.lang.String
  • Since: 2.3.1
  • Required: No
  • User Property: testNGArtifactName
  • Default: org.testng:testng

testSourceDirectory:

The test source directory containing test class sources.
  • Type: java.io.File
  • Since: 2.2
  • Required: Yes
  • User Property: project.build.testSourceDirectory

testTargetDirectory:

Target directory for Nar test construction. Defaults to "${project.build.directory}/test-nar" for "nar-testCompile" goal
  • Type: java.io.File
  • Required: No

testUnpackDirectory:

Target directory for Nar test unpacking. Defaults to "${testTargetDirectory}"
  • Type: java.io.File
  • Required: No

threadCount:

(TestNG only) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with parallel.
  • Type: int
  • Since: 2.2
  • Required: No
  • User Property: threadCount

trimStackTrace:

Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: trimStackTrace
  • Default: true

unpackDirectory:

Target directory for Nar file unpacking. Defaults to "${targetDirectory}"
  • Type: java.io.File
  • Required: No

useFile:

Option to generate a file test report or just output the test report to the console.
  • Type: boolean
  • Required: No
  • User Property: surefire.useFile
  • Default: true

useManifestOnlyJar:

By default, Surefire forks your tests using a manifest-only jar; set this parameter to "false" to force it to launch your tests with a plain old Java classpath. (See http://maven.apache.org/plugins/maven-surefire-plugin/examples/class- loading.html for a more detailed explanation of manifest-only jars and their benefits.) Default value is "true". Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
  • Type: boolean
  • Since: 2.4.3
  • Required: No
  • User Property: surefire.useManifestOnlyJar
  • Default: true

useSystemClassLoader:

Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's classloader. Default value is "true".
  • Type: java.lang.Boolean
  • Since: 2.3
  • Required: No
  • User Property: surefire.useSystemClassLoader

workingDirectory:

Command line working directory.
  • Type: java.io.File
  • Since: 2.1.3
  • Required: No
  • User Property: basedir