3
votes

I'm using maven to run my integration tests which are in a TestNG suite. When running the suite under eclipse- my test suite runs successfully. When running "mvn verify" to run my integration tests, I see the failsafe plugin configurations debug prints including the correct path for the suite.xml file and my compiled classes, but it doesn't execute my tests (build process completes successfully).

I've tried to run the same pom configuration but using the surefire plugin instead of the failsafe plugins and my tests executed successfully.

        <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.12.3</version>
                <configuration>
                    <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/MyTestNgSuiteFile.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <argLine>-Xmx1024m</argLine>
                </configuration>
                    <executions>
          <execution>
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <phase>verify</phase>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>

            </plugin>

Here is the relevant console output:

[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 [DEBUG] Excluded: junit:junit:jar:3.8.1 [DEBUG] Excluded: org.apache.maven:maven-core:jar:2.0.9 [DEBUG] Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.9 [DEBUG] Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-monitor:jar:2.0.9 [DEBUG] Excluded: classworlds:classworlds:jar:1.1 [DEBUG] Excluded: org.apache.maven:maven-toolchain:jar:2.0.9 [DEBUG] Configuring mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.12.3, parent: sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test' with basic configurator --> [DEBUG] (s) argLine = -Xmx1024m [DEBUG] (s) basedir = PathToMyDir\MyProject [DEBUG] (s) childDelegation = false [DEBUG] (s) classesDirectory = PathToMyDir\MyProject\target\classes [DEBUG] (s) disableXmlReport = false [DEBUG] (s) enableAssertions = true [DEBUG] (s) forkMode = once [DEBUG] (s) junitArtifactName = junit:junit [DEBUG] (s) localRepository = id: local url: file:///..../.m2/repository/ layout: none

[DEBUG] (f) parallelMavenExecution = false [DEBUG] (s) perCoreThreadCount = true [DEBUG] (s) pluginArtifactMap = {org.apache.maven.plugins:maven-failsafe-plugin=org.apache.maven.plugins:maven-failsafe-plugin:maven-plugin:2.12.3:, org.apache.maven.surefire:surefire-booter=org.apache.maven.surefire:surefire-booter:jar:2.12.3:compile, org.apache.maven.surefire:surefire-api=org.apache.maven.surefire:surefire-api:jar:2.12.3:compile, org.apache.maven.surefire:maven-surefire-common=org.apache.maven.surefire:maven-surefire-common:jar:2.12.3:compile, org.apache.commons:commons-lang3=org.apache.commons:commons-lang3:jar:3.1:compile, org.apache.maven.shared:maven-common-artifact-filters=org.apache.maven.shared:maven-common-artifact-filters:jar:1.3:compile, org.codehaus.plexus:plexus-utils=org.codehaus.plexus:plexus-utils:jar:3.0.5:compile, org.apache.maven.reporting:maven-reporting-api=org.apache.maven.reporting:maven-reporting-api:jar:2.0.9:compile, org.apache.maven.plugin-tools:maven-plugin-annotations=org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.1:compile} [DEBUG] (f) pluginDescriptor = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.failsafe.HelpMojo', role hint: 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:help' role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.failsafe.IntegrationTestMojo', role hint: 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test' role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.failsafe.VerifyMojo', role hint: 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify' --- [DEBUG] (s) printSummary = true [DEBUG] (s) projectArtifactMap = {All Artifacts Here} [DEBUG] (s) redirectTestOutputToFile = false [DEBUG] (s) remoteRepositories = [ id: central url: http://repo1.maven.org/maven2 layout: default snapshots: [enabled => false, update => daily] releases: [enabled => true, update => never] ] [DEBUG] (s) reportFormat = brief [DEBUG] (s) reportsDirectory = PathToMyDir\MyProject\target\failsafe-reports [DEBUG] (s) runOrder = filesystem [DEBUG] (s) skip = false [DEBUG] (s) skipTests = false [DEBUG] (s) suiteXmlFiles = [PathToMyDir\MyProject\src\test\resources\MyTestNgSuiteFile.xml] [DEBUG] (s) summaryFile = PathToMyDir\MyProject\target\failsafe-reports\failsafe-summary.xml [DEBUG] (s) testClassesDirectory = PathToMyDir\MyProject\target\test-classes [DEBUG] (s) testNGArtifactName = org.testng:testng [DEBUG] (s) testSourceDirectory = PathToMyDir\MyProject\src\test\java [DEBUG]
(s) trimStackTrace = true [DEBUG] (s) useFile = true [DEBUG] (s) useManifestOnlyJar = true [DEBUG] (s) useSystemClassLoader = true [DEBUG] (s) useUnlimitedThreads = false [DEBUG] (s) workingDirectory = PathToMyDir\MyProject [DEBUG] (s) project = MavenProject: MyParentProject:MyProject:0.0.1-SNAPSHOT @ PathToMyDir\MyProject\pom.xml [DEBUG]
(s) session = org.apache.maven.execution.MavenSession@bffe59 [DEBUG] -- end configuration -- [WARNING] File encoding has not been set, using platform encoding Cp1255, i.e. build is platform dependent! [INFO] [INFO] --- maven-failsafe-plugin:2.12.3:verify (verify) @ MyProject --- [DEBUG] Configuring mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.12.3, parent: sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify' with basic configurator --> [DEBUG] (s) basedir = PathToMyDir\MyProject [DEBUG] (s) reportsDirectory = PathToMyDir\MyProject\target\failsafe-reports [DEBUG] (s) skip = false [DEBUG] (f) summaryFile = PathToMyDir\MyProject\target\failsafe-reports\failsafe-summary.xml [DEBUG] (s) testClassesDirectory = PathToMyDir\MyProject\target\test-classes [DEBUG] (s) testFailureIgnore = false [DEBUG] -- end configuration -- [INFO] Failsafe report directory: PathToMyDir\MyProject\target\failsafe-reports [WARNING] File encoding has not been set, using platform encoding Cp1255, i.e. build is platform dependent!

It looks like the "Forking command line: cmd.exe /X /C "C:\Program Files (x86)\Java\jdk1.7.0_04..." command is missing and not getting executed. I would appreciate any help.

1
What does "but it doesn't run my tests" mean? error messages ? Furthermore have you configured the maven-failsafe-plugin correctly?khmarbaise
I see no errors and my tests were not executed. I just set the failsafe-plugin "verify" goal to the maven "verify" cycle. Anyway, it also happens when I explicitly execute "failsafe:verify" or "failsafe:integration-test"Omri
Can you post your complete pom please.khmarbaise
Can you post the console message when you are running above targets.Prasad S Deshpande
I've edited my original post with the requested info.Omri

1 Answers

2
votes

I had a similar issue and downgrading the failsafe plugin to 2.11 worked for me.