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]