Error Saving Test

48 views
Skip to first unread message

Grant

unread,
Apr 20, 2012, 5:00:06 AM4/20/12
to magictest-users
Hi Thomas,

I'm able to Run a test and get the html output. I can rerun the test
either from a menu or the link on the web page.

If I try to save the test (either from the menu or the web page) I get
an error - "Could not find the main class: org.magictest.MagicTest.
Program will exit"

Thanks,
Grant

Thomas Mauch

unread,
Apr 20, 2012, 9:21:04 AM4/20/12
to magicte...@googlegroups.com
Where do you get this message - in the console or in a dialog box?
Do you find more information, e.g. a stacktrace, may be in the Eclipse error log?
I assume you are using version 201203102216?

Regards,
Thomas

Grant

unread,
Apr 21, 2012, 6:31:55 AM4/21/12
to magicte...@googlegroups.com
It is in a standard java dialog - you would get the same message launching something from the command line if it couldn't find the main class.  I'm using the Spring STS version of eclipse and version 201203102216.

There doesn't appear to be a related stack trace in the error log.

Grant

Thomas Mauch

unread,
Apr 21, 2012, 10:28:31 AM4/21/12
to magicte...@googlegroups.com
I must admit I have no idea what exactly goes wrong.
Most likely it seems to be a classpath / classloader problem - this would at least explain why find a strange ClassCastException in the Eclipse log.
Have you already tried to uninstall and reinstall the plugin? I assume you installed it by putting it into the Eclipse dropins folder.


Regards,
Thomas

Am Freitag, 20. April 2012 11:00:06 UTC+2 schrieb Grant:

Grant

unread,
May 3, 2012, 3:24:58 PM5/3/12
to magicte...@googlegroups.com
FYI, I was able to get it work work using MyEclipse 8.0 ( based on Eclipse 3.5.1 ) using the dropins folder.

It appears to be a compatibility issue with Spring STS if you want to try reproducing the error yourself.

Regards,
Grant

Thomas Mauch

unread,
May 4, 2012, 7:47:17 AM5/4/12
to magicte...@googlegroups.com
Great to hear that.
As I do not use Spring STS I will not do any further investigation.
I will however release a new release in the next days for which I also had to some internal refactoring - may be you can give it a try.

May I ask you how what you think about the approach used for testing? Do you think the tool is useful?

Regards,
Thomas

Grant

unread,
May 4, 2012, 8:15:33 AM5/4/12
to magicte...@googlegroups.com
Spring STS is a free download - so it's easy for you to try.  As it our default development environment it will be a hard sell to get adoption without it working there.

Unless there is an easy way to use the tool without eclipse but still get the rapid testing cycle that it supports?

Grant

Grant

unread,
May 7, 2012, 11:14:57 AM5/7/12
to magicte...@googlegroups.com
Hi Thomas,

Because I think your approach has a lot of merit I am trying to inch my way along :)

I am trying to run a simple test using TestNG.  My test class is very simple but extends AbstractTestNGSpringContextTests (a commonly used base class when running TestNG unit tests with Spring).  If I don't extend  AbstractTestNGSpringContextTests then the error does not occur.  My spring context is empty at this point so nothing being loaded in the context is the source of the error.

package magictest;

import org.magictest.client.Trace;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;

@Test
@ContextConfiguration
public class MagicTestTester extends AbstractTestNGSpringContextTests {

@Trace(traceClass="magictest.MyTestBean",traceMethod="/get.+/")
public void testMyTestBean(){
MyTestBean test = new MyTestBean();
test.setName("Grant");
test.getName();

}
}

I am getting the following error:

java.lang.NullPointerException
at magictest.MagicTestTester.testMyTestBean_magictest_MyTestBean_getName_$$Ljava$lang$String(MagicTestTester.java)
at magictest.MagicTestTester.testMyTestBean(MagicTestTester.java:33)
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:597)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:74)
at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:176)
at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
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:597)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:189)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:668)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:856)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1180)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
at org.testng.TestRunner.privateRun(TestRunner.java:749)
at org.testng.TestRunner.run(TestRunner.java:600)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
at org.testng.SuiteRunner.run(SuiteRunner.java:223)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1082)
at org.testng.TestNG.runSuitesLocally(TestNG.java:996)
at org.testng.TestNG.run(TestNG.java:932)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:110)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

Regards,
Grant


On Friday, May 4, 2012 8:15:33 AM UTC-4, Grant wrote:
Spring STS is a free download - so it's easy for you to try.  As it our default development environment it will be a hard sell to get adoption without it working there.

Unless there is an easy way to use the tool without eclipse but still get the rapid testing cycle that it supports?

Grant
Reply all
Reply to author
Forward
0 new messages