You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wayne Fay <wa...@gmail.com> on 2007/04/03 18:25:26 UTC

Surefire TestNG troubles

Wondering who is using TestNG successfully on the list??

I've recently been working on a new EJB3/JPA app by using Hibernate's
CaveatEmptor JPA example as the base. Everything works great in Ant
but I'm trying to make it work in Maven2...

Here's the failure I'm getting right this minute:
10:54:44,575 DEBUG org.jboss.kernel.KernelFactory:86 - Starting JBoss
Kernel construction...
10:54:44,825 DEBUG org.jboss.kernel.KernelFactory:112 - Completed
JBoss Kernel construction.  Duration: 250 milliseconds

org.apache.maven.surefire.booter.SurefireExecutionException: null;
nested exception is java.lang.NullPointerException: null
java.lang.NullPointerException
        at org.apache.maven.surefire.report.AbstractTextReporter.testFailed(AbstractTextReporter.java:111)
        at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:335)
        at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:317)
        at org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:100)
        at org.testng.internal.Invoker.runTestListeners(Invoker.java:1164)
        at org.testng.internal.Invoker.runTestListeners(Invoker.java:1149)
        at org.testng.internal.Invoker.handleConfigurationFailure(Invoker.java:191)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:170)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:236)
        at org.testng.SuiteRunner.run(SuiteRunner.java:145)
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:863)

Arguably, I suppose the problem could be related to the TestNG v5.4
used by Ant vs the TestNG v5.1 used by Maven. But I'm just getting
into this and thought I'd ask before digging into it more myself.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Surefire TestNG troubles

Posted by Wayne Fay <wa...@gmail.com>.
I got a little further (still not running perfectly) by adding the
following to my pom:

  <pluginRepositories>
    <pluginRepository>
      <id>howardlewisship</id>
      <url>http://howardlewisship.com/repository</url>
    </pluginRepository>
    <pluginRepository>
      <id>maven-snapshots</id>
      <url>http://people.apache.org/maven-snapshot-repository</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.8-SNAPSHOT</version>
        ....

Both of my tests failed (run fine with Ant) but I'm getting close...

Wayne

On 4/3/07, Wayne Fay <wa...@gmail.com> wrote:
> Wondering who is using TestNG successfully on the list??
>
> I've recently been working on a new EJB3/JPA app by using Hibernate's
> CaveatEmptor JPA example as the base. Everything works great in Ant
> but I'm trying to make it work in Maven2...
>
> Here's the failure I'm getting right this minute:
> 10:54:44,575 DEBUG org.jboss.kernel.KernelFactory:86 - Starting JBoss
> Kernel construction...
> 10:54:44,825 DEBUG org.jboss.kernel.KernelFactory:112 - Completed
> JBoss Kernel construction.  Duration: 250 milliseconds
>
> org.apache.maven.surefire.booter.SurefireExecutionException: null;
> nested exception is java.lang.NullPointerException: null
> java.lang.NullPointerException
>         at org.apache.maven.surefire.report.AbstractTextReporter.testFailed(AbstractTextReporter.java:111)
>         at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:335)
>         at org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:317)
>         at org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:100)
>         at org.testng.internal.Invoker.runTestListeners(Invoker.java:1164)
>         at org.testng.internal.Invoker.runTestListeners(Invoker.java:1149)
>         at org.testng.internal.Invoker.handleConfigurationFailure(Invoker.java:191)
>         at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:170)
>         at org.testng.SuiteRunner.privateRun(SuiteRunner.java:236)
>         at org.testng.SuiteRunner.run(SuiteRunner.java:145)
>         at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
>         at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
>
> Arguably, I suppose the problem could be related to the TestNG v5.4
> used by Ant vs the TestNG v5.1 used by Maven. But I'm just getting
> into this and thought I'd ask before digging into it more myself.
>
> Wayne
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Surefire TestNG troubles

Posted by Mark Derricutt <ma...@talios.com>.
Due to a change in TestNG's API versions later than 5.1 no longer work with
the current surefire release.  This is currently being worked on by the
TestNG developers and hopefully won't be too long in coming.

For now - if you need any changes from 5.2+ your best course of action would
be using the antrun plugin.  Or as an alternative, another TestNG user has
written there own maven plugin specifically for TestNG (I'll see if I can
find a reference to it and follow up this post).

On 4/4/07, Wayne Fay <wa...@gmail.com> wrote:
>
> Arguably, I suppose the problem could be related to the TestNG v5.4
> used by Ant vs the TestNG v5.1 used by Maven. But I'm just getting
> into this and thought I'd ask before digging into it more myself.
>

Re: Surefire TestNG troubles

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 4/7/07, Wayne Fay <wa...@gmail.com> wrote:

> Don't suppose you have a working JPA with Hibernate EM and TestNG
> tests etc example I could take a look at (ie complete source code)
> just to get this all sorted out? That would be super helpful.

As you wish...

http://www.jaceklaskowski.pl/wiki/Nauka_Java_Persistence_z_Apache_Maven_2_i_dostawcami_JPA:_OpenJPA%2C_Hibernate_i_TopLink
http://www.jaceklaskowski.pl/wiki/Java_Persistence_API_z_OpenJPA_i_Derby_oraz_TestNG_z_Eclipse_IDE_w_tle

These are articles in Polish about setting up a test environment to
learn JPA bits. If Polish is not on the list of the languages of
yours, ask when you're in trouble. I'd be glad to help out.

I could translate and publish them somewhere, but don't know where
yet. If you know a place for such articles let me know.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Surefire TestNG troubles

Posted by Wayne Fay <wa...@gmail.com>.
Thanks Jacek. I actually found the Hibernate artifacts on:

  <repositories>
    <repository>
      <id>andromeda</id>
      <name>team-andromeda</name>
      <url>http://team.andromda.org/maven2/</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>howardlewisship</id>
      <url>http://howardlewisship.com/repository</url>
    </pluginRepository>
  </pluginRepositories>

Don't suppose you have a working JPA with Hibernate EM and TestNG
tests etc example I could take a look at (ie complete source code)
just to get this all sorted out? That would be super helpful.

Wayne

On 4/6/07, Jacek Laskowski <ja...@laskowski.net.pl> wrote:
> On 4/3/07, Wayne Fay <wa...@gmail.com> wrote:
> > Wondering who is using TestNG successfully on the list??
>
> I think I am. The TestNG tests I've been doing are not very
> sophisticated, but let me test out the JPA features.
>
> > I've recently been working on a new EJB3/JPA app by using Hibernate's
> > CaveatEmptor JPA example as the base. Everything works great in Ant
> > but I'm trying to make it work in Maven2...
>
> I'm using JPA's outside the container feature, i.e. Hibernate
> EntityManager in TestNG tests that are executed via M2 outside EJB3
> container. Here's the hibernate configuration for M2 2.0.6 with
> TestNG. It's not that you'll be able to run EJB3 apps, but perhaps
> might be of some help.
>
> I had to install Hibernate EntityManager et al manually via
> maven-install-plugin.
>
> <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>
>   <groupId>pl.jaceklaskowski.jpa.query</groupId>
>   <artifactId>jpa-query</artifactId>
>   <name>jpa-query</name>
>   <version>1.0</version>
>   <dependencies>
>     <dependency>
>       <groupId>org.apache.derby</groupId>
>       <artifactId>derby</artifactId>
>       <version>10.2.2.0</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.derby</groupId>
>       <artifactId>derbyclient</artifactId>
>       <version>10.2.2.0</version>
>     </dependency>
>     <dependency>
>       <groupId>org.testng</groupId>
>       <artifactId>testng</artifactId>
>       <version>5.1</version>
>       <scope>test</scope>
>       <classifier>jdk15</classifier>
>     </dependency>
>   </dependencies>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.5</source>
>           <target>1.5</target>
>         </configuration>
>       </plugin>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <version>2.3</version>
>       </plugin>
>     </plugins>
>   </build>
>   <pluginRepositories>
>     <pluginRepository>
>       <id>apache-snapshots</id>
>       <name>Apache Snapshots Repository</name>
>       <url>http://people.apache.org/maven-snapshot-repository</url>
>       <layout>default</layout>
>       <snapshots>
>         <enabled>true</enabled>
>         <updatePolicy>daily</updatePolicy>
>         <checksumPolicy>ignore</checksumPolicy>
>       </snapshots>
>       <releases>
>         <enabled>false</enabled>
>       </releases>
>     </pluginRepository>
>     <pluginRepository>
>       <id>codehaus-snapshots</id>
>       <name>Codehaus Snapshots Repository</name>
>       <url>http://snapshots.repository.codehaus.org</url>
>       <layout>default</layout>
>       <snapshots>
>         <enabled>true</enabled>
>         <updatePolicy>daily</updatePolicy>
>         <checksumPolicy>ignore</checksumPolicy>
>       </snapshots>
>       <releases>
>         <enabled>false</enabled>
>       </releases>
>     </pluginRepository>
>   </pluginRepositories>
>     <profile>
>       <id>hibernate</id>
>       <dependencies>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate</artifactId>
>           <version>3.2.2.ga</version>
>           <exclusions>
>             <exclusion>
>               <groupId>javax.transaction</groupId>
>               <artifactId>jta</artifactId>
>             </exclusion>
>           </exclusions>
>         </dependency>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate-entitymanager</artifactId>
>           <version>3.3.1</version>
>         </dependency>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate-annotations</artifactId>
>           <version>3.3.0.ga</version>
>         </dependency>
>         <dependency>
>           <groupId>javax.persistence</groupId>
>           <artifactId>persistence-api</artifactId>
>           <version>1.0</version>
>         </dependency>
>         <dependency>
>           <groupId>jboss</groupId>
>           <artifactId>jboss-archive-browsing</artifactId>
>           <version>5.0.0alpha-200607201-119</version>
>         </dependency>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate-commons-annotations</artifactId>
>           <version>3.0.0.ga</version>
>         </dependency>
>         <dependency>
>           <groupId>javassist</groupId>
>           <artifactId>javassist</artifactId>
>           <version>3.4</version>
>         </dependency>
>         <dependency>
>           <groupId>javax.transaction</groupId>
>           <artifactId>jta</artifactId>
>           <version>1.0.1B</version>
>         </dependency>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate-validator</artifactId>
>           <version>3.0.0.GA</version>
>         </dependency>
>         <dependency>
>           <groupId>log4j</groupId>
>           <artifactId>log4j</artifactId>
>           <version>1.2.14</version>
>         </dependency>
>       </dependencies>
>       <build>
>         <resources>
>           <resource>
>             <directory>src/main/resources/hibernate</directory>
>           </resource>
>         </resources>
>       </build>
>     </profile>
>   </profiles>
> </project>
>
> Jacek
>
> --
> Jacek Laskowski
> http://www.JacekLaskowski.pl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Surefire TestNG troubles

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 4/3/07, Wayne Fay <wa...@gmail.com> wrote:
> Wondering who is using TestNG successfully on the list??

I think I am. The TestNG tests I've been doing are not very
sophisticated, but let me test out the JPA features.

> I've recently been working on a new EJB3/JPA app by using Hibernate's
> CaveatEmptor JPA example as the base. Everything works great in Ant
> but I'm trying to make it work in Maven2...

I'm using JPA's outside the container feature, i.e. Hibernate
EntityManager in TestNG tests that are executed via M2 outside EJB3
container. Here's the hibernate configuration for M2 2.0.6 with
TestNG. It's not that you'll be able to run EJB3 apps, but perhaps
might be of some help.

I had to install Hibernate EntityManager et al manually via
maven-install-plugin.

<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>
  <groupId>pl.jaceklaskowski.jpa.query</groupId>
  <artifactId>jpa-query</artifactId>
  <name>jpa-query</name>
  <version>1.0</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <version>10.2.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derbyclient</artifactId>
      <version>10.2.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.1</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.3</version>
      </plugin>
    </plugins>
  </build>
  <pluginRepositories>
    <pluginRepository>
      <id>apache-snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/maven-snapshot-repository</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <id>codehaus-snapshots</id>
      <name>Codehaus Snapshots Repository</name>
      <url>http://snapshots.repository.codehaus.org</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
  </pluginRepositories>
    <profile>
      <id>hibernate</id>
      <dependencies>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate</artifactId>
          <version>3.2.2.ga</version>
          <exclusions>
            <exclusion>
              <groupId>javax.transaction</groupId>
              <artifactId>jta</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-entitymanager</artifactId>
          <version>3.3.1</version>
        </dependency>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-annotations</artifactId>
          <version>3.3.0.ga</version>
        </dependency>
        <dependency>
          <groupId>javax.persistence</groupId>
          <artifactId>persistence-api</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>jboss</groupId>
          <artifactId>jboss-archive-browsing</artifactId>
          <version>5.0.0alpha-200607201-119</version>
        </dependency>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-commons-annotations</artifactId>
          <version>3.0.0.ga</version>
        </dependency>
        <dependency>
          <groupId>javassist</groupId>
          <artifactId>javassist</artifactId>
          <version>3.4</version>
        </dependency>
        <dependency>
          <groupId>javax.transaction</groupId>
          <artifactId>jta</artifactId>
          <version>1.0.1B</version>
        </dependency>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-validator</artifactId>
          <version>3.0.0.GA</version>
        </dependency>
        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.14</version>
        </dependency>
      </dependencies>
      <build>
        <resources>
          <resource>
            <directory>src/main/resources/hibernate</directory>
          </resource>
        </resources>
      </build>
    </profile>
  </profiles>
</project>

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org