3

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.

Omri
  • 1,058
  • 3
  • 14
  • 26
  • What does "but it doesn't run my tests" mean? error messages ? Furthermore have you configured the maven-failsafe-plugin correctly? – khmarbaise Sep 24 '12 at 09:17
  • 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 Sep 24 '12 at 09:54
  • Can you post your complete pom please. – khmarbaise Sep 24 '12 at 10:41
  • Can you post the console message when you are running above targets. – Prasad S Deshpande Sep 24 '12 at 10:51
  • I've edited my original post with the requested info. – Omri Sep 24 '12 at 12:52
  • Can you show an example of your testng tests, cause in the console output there is no error visible? Have you annotated you tests correctly with the TestNG annotation and not with JUnit or vice versa? Why do you need a testng suite file? – khmarbaise Sep 24 '12 at 13:10
  • I've tried to run the same pom configuration but using the surefire plugin instead of the failsafe plugins and my tests executed successfully. It also works perfectly in eclipse, so I don't believe there is any problem with my testNG suite. – Omri Sep 24 '12 at 13:51
  • You don't believe...but it looks like this. Sorry. – khmarbaise Sep 25 '12 at 15:53
  • Do you have the dependency on TestNG set up as defined [here](http://maven.apache.org/plugins/maven-failsafe-plugin/examples/testng.html)? Dependencies are not shown in your config above. Also, are you using the same version of Maven in Eclipse and on the command line? – user944849 Sep 26 '12 at 14:23
  • When running the same configuration and replacing just the failsafe plugin with the surefire plugin (keeping all other config, just replacing artifactID and Version)- The tests run succesully. I'm pretty sure It's not a dependency or a testNG suite problem. – Omri Sep 27 '12 at 05:26

1 Answers1

2

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

Lars Grammel
  • 1,999
  • 16
  • 21
  • It worked just after changing the fail-safe plugin version to 2.11!!! Thank you very much Lars! I wonder if this is a Maven bug... – Omri Oct 02 '12 at 06:31