Maven 2 TestNG skipping some tests

2009-09-28 Thread Toby Hobson
I'm finding the TestNG plugin to be a bit flaky. For example I have a few
tests defined in a couple of classes and I wanted to add a new test class so
I created a new class:

package com.pingmenow.services;
import org.testng.annotations.Test;

public class DummyTest {
  @Test
  public void dummyTest() {
assert 1 == 2;
  }
}

I saved this under src/test/java/com/pingmenow/services/DummyTest.java
(alongside my other test classes) but when I execute mvn test it skips this
class:

[INFO] Scanning for projects...
[INFO]

[INFO] Building pingmenow Tapestry 5 Application
[INFO]task-segment: [test]
[INFO]

[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] Copying 10 resources
[INFO] [javarebel:generate {execution: generate-rebel-xml}]
[INFO] Processing com.pingmenow:pingmenow with packaging war
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory:
/Users/toby/Documents/workspace/pingmenow/target/surefire-reports

---
 T E S T S
---
Running TestSuite
...
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.463 sec

Results :

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0

[INFO] support.GenericApplicationContext Closing
org.springframework.context.support.genericapplicationcont...@af7c57:
display name
[org.springframework.context.support.genericapplicationcont...@af7c57];
startup date [Mon Sep 28 16:03:29 BST 2009]; root of context hierarchy
[INFO] support.DefaultListableBeanFactory Destroying singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@cbc2d3:
defining beans
[org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,sessionFactory,hibernateTemplate,dataSource,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,propertyPlaceholderConfigurer,serverService];
root of factory hierarchy
[INFO] hibernate3.LocalSessionFactoryBean Closing Hibernate SessionFactory
[INFO] impl.SessionFactoryImpl closing
[INFO] hbm2ddl.SchemaExport Running hbm2ddl schema export
[INFO] hbm2ddl.SchemaExport exporting generated schema to database
[INFO] hbm2ddl.SchemaExport schema export complete
[INFO]

[INFO] BUILD SUCCESSFUL
[INFO]

[INFO] Total time: 7 seconds
[INFO] Finished at: Mon Sep 28 16:03:31 BST 2009
[INFO] Final Memory: 12M/22M
[INFO]


I'm running maven 2.2.0:
Apache Maven 2.2.0 (r788681; 2009-06-26 14:04:01+0100)
Java version: 1.5.0_20
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: mac os x version: 10.5.8 arch: i386 Family: unix

My pom.xml looks like this:

project
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=
http://maven.apache.org/POM/4.0.0;
modelVersion4.0.0/modelVersion
groupIdcom.pingmenow/groupId
artifactIdpingmenow/artifactId
version1.0-SNAPSHOT/version
packagingwar/packaging
namepingmenow Tapestry 5 Application/name
dependencies
!--
A dependency on either JUnit or TestNG is required, or the
surefire
plugin (which runs the tests) will fail, preventing Maven from
packaging the WAR. Tapestry includes a large number of testing
facilities designed for use with TestNG (http://testng.org/), so
it's
recommended.
--
dependency
groupIdorg.testng/groupId
artifactIdtestng/artifactId
version5.8/version
classifierjdk15/classifier
scopetest/scope

Re: Maven 2 TestNG skipping some tests

2009-09-28 Thread Ed Hillmann
On Tue, Sep 29, 2009 at 1:14 AM, Toby Hobson toby.hob...@googlemail.comwrote:

 I'm finding the TestNG plugin to be a bit flaky. For example I have a few
 tests defined in a couple of classes and I wanted to add a new test class
 so
 I created a new class:

 package com.pingmenow.services;
 import org.testng.annotations.Test;

 public class DummyTest {
  @Test
  public void dummyTest() {
assert 1 == 2;
  }
 }


Is the JVM being run without assertions being enabled?  Typically, unless
you provide the JVM the -ea command-line option, assertions are not used.

I've always used the org.testng.Assert class in testNG classes instead of
java assert keywords.  This way it doesn't matter how the JVM is started.
Can you try that to confirm that the test is executing?

Hope this helps,
Ed


Using maven and testng - collab workaround

2007-11-13 Thread Erik Drolshammer
Hi! 
I got maven to run with testng 5.5 by using
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
version2.4-collab-SNAPSHOT/version
/plugin

and 

dependency
groupIdorg.testng/groupId
artifactIdtestng/artifactId
version5.5/version
scopetest/scope
classifierjdk15/classifier
/dependency



However, I can't get the suiteXmlFile configuration option to work
properly. 

Can anyone point me to a testng.xml file that runs the same set of tests
as are run without any config? 

(I have searched the src for the surefire-plugin, but I couldn't find
the default testng.xml file.) 


Resources: 
http://maven.apache.org/plugins/maven-surefire-plugin/examples/testng.html
http://docs.codehaus.org/pages/viewpage.action?pageId=62120
http://maven.apache.org/plugins/maven-surefire-plugin/examples/testng.html

-- 
Regards
Erik Drolshammer 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using maven and testng - collab workaround

2007-11-13 Thread Erik Drolshammer
I reposted my question in a new thread. Search for subject Testng with 
testng.xml config file.


--
Regards
Erik Drolshammer

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using maven and testng

2007-04-03 Thread Wayne Fay

I've run into exactly the same problem... Did you ever get any
resolution to this, Lee?

Wayne

On 11/22/06, Lee Bieber [EMAIL PROTECTED] wrote:

I'm trying to get testng working with maven. I've configured my pom.xml per the 
documentation
..
  dependency
groupIdorg.testng/groupId
artifactIdtestng/artifactId
version5.1/version
scopetest/scope
classifierjdk15/classifier
/dependency
/dependencies
build
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
suiteXmlFiles

suiteXmlFilesrc/test/java/com/trovix/dts/web/controller/web-controller-testng-functional.xml/suiteXmlFile
/suiteXmlFiles
/configuration
/plugin
/plugins


but when I run mvn test  I get the following exception:

---
 T E S T S
---
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:106)
at 
org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:299)
at 
org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:281)
at 
org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:97)
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:223)
at org.testng.SuiteRunner.run(SuiteRunner.java:145)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
at 
org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:64)
at 
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
[INFO] 
[ERROR] BUILD FAILURE

Any ideas on what I am doing wrong??

Thanks




Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Maven and TestNG

2006-11-22 Thread Wim Deblauwe

Hi,

what is the current status on Maven2 and TestNG?

This blog entry[1] shows me a way to avoid surefire, but this does not feel
right. The official TestNG documentation[2] talks about using surefire
2.8-SNAPSHOT, but when I declare this version, all I get from maven is this:

[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

GroupId: org.apache.maven.plugins
ArtifactId: maven-plugins
Version: 2-SNAPSHOT

Reason: Unable to download the artifact from any repository

Notice the version 2-SNAPSHOT, although I put 2.8-SNAPSHOT in my pom.xml! I
added the extra repository (http://howardlewisship.com/repository), so that
should be ok.

any help would highly appriciated.

regards,

Wim


[1]http://www.ninthavenue.com.au/blog/maven_and_testng
[2]http://testng.org/doc/maven.html


Re: Maven and TestNG

2006-11-22 Thread Marco Mistroni

Hello,
 try with this

dependencies
   dependency
 groupIdorg.testng/groupId
 artifactIdtestng/artifactId
 version5.1/version
 scopetest/scope
 classifierjdk15/classifier
   /dependency
 /dependencies

 build
   plugins
 plugin
   artifactIdmaven-surefire-plugin/artifactId
   configuration
 suiteXmlFiles
   suiteXmlFilesrc/test/resources/testing.xml/suiteXmlFile
 /suiteXmlFiles
   /configuration
 /plugin
   /plugins
 /build


hth
marco


Re: Maven and TestNG

2006-11-22 Thread Wim Deblauwe

Thanks, that runs my tests. It a pity that I have to add all my packages to
my testng.xml file. Do you know a way to say: recursively from this one?

This is what I got now:

suite name=All tests verbose=1
   test name=All tests
   packages
   package name=net.sourceforge.vigilog/
   package name=net.sourceforge.vigilog.parse/
   package name=net.sourceforge.vigilog.models/
   /packages
   classes
   class name=
net.sourceforge.vigilog.parse.Log4jXMLFileLogFileParserTest
   methods
   exclude name=testBigFileParsing/
   /methods
   /class
   /classes
   /test

regards,

Wim

2006/11/22, Marco Mistroni [EMAIL PROTECTED]:


Hello,
  try with this

dependencies
dependency
  groupIdorg.testng/groupId
  artifactIdtestng/artifactId
  version5.1/version
  scopetest/scope
  classifierjdk15/classifier
/dependency
  /dependencies

  build
plugins
  plugin
artifactIdmaven-surefire-plugin/artifactId
configuration
  suiteXmlFiles
suiteXmlFilesrc/test/resources/testing.xml/suiteXmlFile
  /suiteXmlFiles
/configuration
  /plugin
/plugins
  /build


hth
marco




Re: Maven and TestNG

2006-11-22 Thread Marco Mistroni

Hello Wim,
 sorry havent' had a look at TestNG in a bit (i m doing it on my leasure
time..which is almost null).

I m sure there are parameters in TestNG with which you can configure
dynamically
the tests that run (for example, by making all tests part of the same group
and specifying which
test to run.. i m sure you can use wildcard with packages..).
Pls have a look at TestNG documentation (or TestNG mailing list), you will
find more help there

hth
marco

On 11/22/06, Wim Deblauwe [EMAIL PROTECTED] wrote:


Thanks, that runs my tests. It a pity that I have to add all my packages
to
my testng.xml file. Do you know a way to say: recursively from this one?

This is what I got now:

suite name=All tests verbose=1
test name=All tests
packages
package name=net.sourceforge.vigilog/
package name=net.sourceforge.vigilog.parse/
package name=net.sourceforge.vigilog.models/
/packages
classes
class name=
net.sourceforge.vigilog.parse.Log4jXMLFileLogFileParserTest
methods
exclude name=testBigFileParsing/
/methods
/class
/classes
/test

regards,

Wim

2006/11/22, Marco Mistroni [EMAIL PROTECTED]:

 Hello,
   try with this

 dependencies
 dependency
   groupIdorg.testng/groupId
   artifactIdtestng/artifactId
   version5.1/version
   scopetest/scope
   classifierjdk15/classifier
 /dependency
   /dependencies

   build
 plugins
   plugin
 artifactIdmaven-surefire-plugin/artifactId
 configuration
   suiteXmlFiles
 suiteXmlFilesrc/test/resources/testing.xml/suiteXmlFile
   /suiteXmlFiles
 /configuration
   /plugin
 /plugins
   /build


 hth
 marco






Using maven and testng

2006-11-22 Thread Lee Bieber
I'm trying to get testng working with maven. I've configured my pom.xml per the 
documentation
..
  dependency
groupIdorg.testng/groupId
artifactIdtestng/artifactId
version5.1/version
scopetest/scope
classifierjdk15/classifier
/dependency
/dependencies
build
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
suiteXmlFiles

suiteXmlFilesrc/test/java/com/trovix/dts/web/controller/web-controller-testng-functional.xml/suiteXmlFile
/suiteXmlFiles
/configuration
/plugin
/plugins


but when I run mvn test  I get the following exception:

---
 T E S T S
---
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:106)
at 
org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:299)
at 
org.apache.maven.surefire.report.ReporterManager.testFailed(ReporterManager.java:281)
at 
org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:97)
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:223)
at org.testng.SuiteRunner.run(SuiteRunner.java:145)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
at 
org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:64)
at 
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
[INFO] 
[ERROR] BUILD FAILURE

Any ideas on what I am doing wrong??

Thanks


 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

maven and testng

2006-11-07 Thread Roger Keays
For those people who have struggled using maven with testng, I've 
blogged about how to get it working without using surefire:


http://www.ninthavenue.com.au/blog/maven_and_testng

I hope this helps someone.

--

Ninth Avenue Software
p: +61 7 3137 1351 (UTC +10)
f: +61 7 3102 9141
w: http://www.ninthavenue.com.au
e: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to test an ejb package with Maven and TestNG?

2006-06-28 Thread Tim Kettler

Hi,

see comment inline...

Naresh Bhatia schrieb:

I have a maven project with packaging set to ejb. I would like to test
this project outside an ejb container by simply calling POJO classes
inside it. I have written a very simple test using TestNG:

 


public class UserServiceTest {

 


@Test

public void testGetAllUsers() {

...

}

}

 


However, when Maven runs it says running UserServiceTest, but does not
run the single test inside it. Here's the output:

 


Running org.andromda.timetracker.service.UserServiceTest

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec

 


1)   Why is Maven skipping my test?


Have you specified a testng.xml in you plugin configuration. There seems to be a bug in 
surefire that lets it doesn't pick up the annotated tests (see [1]). The workaround until 
the bug is fixed is to create a testng.xml and specify your tests/suites in there. Here's 
a sample plugin configuration:


plugin
  groupIdorg.apache.maven.plugins/groupId
  artifactIdmaven-surefire-plugin/artifactId
  version2.2/version
  configuration
suiteXmlFiles
  suiteXmlFilesrc/test/resources/testng.xml/suiteXmlFile
/suiteXmlFiles
  /configuration
/plugin



2)   What is the test supposed to run on: classes in the classes
directory or the packaged jar. I suspect it is the former, because it
seems that the packaging is done after the tests are run. If this is
indeed true then, it should really not matter that I am trying to test a
project that will be packaged as an ejb. Correct?



The directories target/classes and target/test-classes are added to the 
classpath.



Thanks.

 


Naresh


Hope this helps
-Tim

[1] http://jira.codehaus.org/browse/MSUREFIRE-117

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to test an ejb package with Maven and TestNG?

2006-06-28 Thread Naresh Bhatia
Thanks Tim. I had niether created a testng.xml nor the surefire config
:-). As soon as I did these, everything started working.

Thanks so much for your help.
Naresh
 
-Original Message-
From: Tim Kettler [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 4:09 AM
To: Maven Users List
Subject: Re: How to test an ejb package with Maven and TestNG?

Hi,

see comment inline...

Naresh Bhatia schrieb:
 I have a maven project with packaging set to ejb. I would like to test
 this project outside an ejb container by simply calling POJO classes
 inside it. I have written a very simple test using TestNG:
 
  
 
 public class UserServiceTest {
 
  
 
 @Test
 
 public void testGetAllUsers() {
 
 ...
 
 }
 
 }
 
  
 
 However, when Maven runs it says running UserServiceTest, but does not
 run the single test inside it. Here's the output:
 
  
 
 Running org.andromda.timetracker.service.UserServiceTest
 
 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07
sec
 
  
 
 1)   Why is Maven skipping my test?

Have you specified a testng.xml in you plugin configuration. There seems
to be a bug in 
surefire that lets it doesn't pick up the annotated tests (see [1]). The
workaround until 
the bug is fixed is to create a testng.xml and specify your tests/suites
in there. Here's 
a sample plugin configuration:

plugin
   groupIdorg.apache.maven.plugins/groupId
   artifactIdmaven-surefire-plugin/artifactId
   version2.2/version
   configuration
 suiteXmlFiles
   suiteXmlFilesrc/test/resources/testng.xml/suiteXmlFile
 /suiteXmlFiles
   /configuration
/plugin

 
 2)   What is the test supposed to run on: classes in the classes
 directory or the packaged jar. I suspect it is the former, because it
 seems that the packaging is done after the tests are run. If this is
 indeed true then, it should really not matter that I am trying to test
a
 project that will be packaged as an ejb. Correct?
 

The directories target/classes and target/test-classes are added to the
classpath.

 
 Thanks.
 
  
 
 Naresh

Hope this helps
-Tim

[1] http://jira.codehaus.org/browse/MSUREFIRE-117

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to test an ejb package with Maven and TestNG?

2006-06-27 Thread Naresh Bhatia
I have a maven project with packaging set to ejb. I would like to test
this project outside an ejb container by simply calling POJO classes
inside it. I have written a very simple test using TestNG:

 

public class UserServiceTest {

 

@Test

public void testGetAllUsers() {

...

}

}

 

However, when Maven runs it says running UserServiceTest, but does not
run the single test inside it. Here's the output:

 

Running org.andromda.timetracker.service.UserServiceTest

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec

 

1)   Why is Maven skipping my test?

2)   What is the test supposed to run on: classes in the classes
directory or the packaged jar. I suspect it is the former, because it
seems that the packaging is done after the tests are run. If this is
indeed true then, it should really not matter that I am trying to test a
project that will be packaged as an ejb. Correct?

 

Thanks.

 

Naresh