Failure in JUnit mode for class CreateFoo: could not create/run JUnit test

2,479 views
Skip to first unread message

ads

unread,
Apr 26, 2007, 3:40:25 AM4/26/07
to testng...@googlegroups.com
Hi,

I am using testng eclipse plugin 5.5. I have test cases written in junit 4.1. I converted them to testng using right click method in eclipse. But now when i try to execute the test case using testng xml file it is giving me following error :

Failure in JUnit mode for class CreateFoo: could not create/run JUnit test suite:
cannot retrieve JUnit method
at org.testng.junit.JUnitTestRunner.runFailed(JUnitTestRunner.java:231)
at org.testng.junit.JUnitTestRunner.start(JUnitTestRunner.java:224)
at org.testng.junit.JUnitTestRunner.run(JUnitTestRunner.java:205)
at org.testng.TestRunner$1.run(TestRunner.java:535)
at org.testng.TestRunner.runWorkers(TestRunner.java:673)
at org.testng.TestRunner.privateRunJUnit(TestRunner.java:547)
at org.testng.TestRunner.run(TestRunner.java:477)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
at org.testng.SuiteRunner.run(SuiteRunner.java:168)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
at org.testng.TestNG.run(TestNG.java:719)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)

Please help me..... I really want this error should be solved as soon as possible.....
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=79930&messageID=145090#145090

Alexandru Popescu ☀

unread,
Apr 26, 2007, 3:51:55 AM4/26/07
to testng...@googlegroups.com
On 4/26/07, ads <testng...@opensymphony.com> wrote:
>
> Hi,
>
> I am using testng eclipse plugin 5.5. I have test cases written in junit 4.1. I converted them to testng using right click method in eclipse. But now when i try to execute the test case using testng xml file it is giving me following error :
>
> Failure in JUnit mode for class CreateFoo: could not create/run JUnit test suite:
> cannot retrieve JUnit method
> at org.testng.junit.JUnitTestRunner.runFailed(JUnitTestRunner.java:231)
> at org.testng.junit.JUnitTestRunner.start(JUnitTestRunner.java:224)
> at org.testng.junit.JUnitTestRunner.run(JUnitTestRunner.java:205)
> at org.testng.TestRunner$1.run(TestRunner.java:535)
> at org.testng.TestRunner.runWorkers(TestRunner.java:673)
> at org.testng.TestRunner.privateRunJUnit(TestRunner.java:547)
> at org.testng.TestRunner.run(TestRunner.java:477)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
> at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
> at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
> at org.testng.SuiteRunner.run(SuiteRunner.java:168)
> at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
> at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
> at org.testng.TestNG.run(TestNG.java:719)
> at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
> at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
>
> Please help me..... I really want this error should be solved as soon as possible.....

1/ If you converted your test to TestNG then there is no reason to run
it in JUnit mode.

2/ You must be assured that the converter output is a valid TestNG
test. As written in the documentation the converter is not 100%, so
human interaction may be needed.

3/ In case you try to run JUnit test through TestNG compatibility
mode, you should be aware (and the documentation states this clearly)
that we do not support running JUnit 4.x tests.

bests,

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

ads

unread,
Apr 26, 2007, 7:05:09 AM4/26/07
to testng...@googlegroups.com
Thanks alex for your quick reply. But i have solved d problem.
If you right click on testng.xml file in eclipse and say run with testng configuration it is giving me above error.
If i right click on testng.xml file in the package explorer and say run with testng configuration, it is running very well.
I don't know what exactly the problem, but this is the solution.....
Is this a bug????

---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=79930&messageID=145151#145151

Alexandru Popescu ☀

unread,
Apr 26, 2007, 7:08:38 AM4/26/07
to testng...@googlegroups.com
On 4/26/07, ads <testng...@opensymphony.com> wrote:
>
> Thanks alex for your quick reply. But i have solved d problem.
> If you right click on testng.xml file in eclipse and say run with testng configuration it is giving me above error.
> If i right click on testng.xml file in the package explorer and say run with testng configuration, it is running very well.

I think the first sentence is missing some detail: where in eclipse? what view?

If you can send me something that would help me reproduce the problem,
then I will try to confirm if it is or not a bug.

bests,

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

> I don't know what exactly the problem, but this is the solution.....

wizardblue

unread,
Apr 30, 2007, 1:46:56 AM4/30/07
to testng...@googlegroups.com
may be put an '@Test' before the class declare will be ok.
code as follow:
@Test
public class TestNG_JUnit_Demo {
...

}
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=79930&messageID=146088#146088

Reply all
Reply to author
Forward
0 new messages