[sip-comm-dev] Debugging individual test classes


#1

Alexander,

I'm currently having some problems running single test classes under the NetBeans
debugger. I'm sure it was working when I set it up 6 months ago, but my problem initially
looks like it is due to NetBeans starting a separate process (outside the IDE) to run the
debugged program and then not having all its properties assigned.

Anyway, I decided to investigate by running the same test class under Eclipse. I
followed your instructions on the wiki, but they don't tell me how to debug a single test
case!

If I right-click (under Eclipse) IcqProtocolProviderSlick and select "debug jUnit test", I
am not surprised to see it fails (no tests to run) because Oscar doesn't get started.

If I right click TestAccountIstallation (which subclasses jUnit TestCase), it runs and fails
because the properties are not setup.

NetBeans actually uses the build.xml to run its debugger, so it is reasonable to expect
the properties and classpaths to be the same. However, Eclipse does not run build.xml
(or does it?). Can you give me any quick instructions on how to get started with
debugging under Eclipse?

Once I can debug under Eclipse, I'll be better able to sort out why it doesn't work
properly under NetBeans.

By the way, I think most project developers use jBuilder... are they currently debugging
the individual slick's without problems?
Regards,

Brian

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hello Brian,

Brian Burch wrote:

Anyway, I decided to investigate by running the same test class under Eclipse. I followed your instructions on the wiki, but they don't tell me how to debug a single test case!

Well this has not really been a common practice. From what I know most of us have been modifying the lib/testing.properties file in order to reduce the number of tests. Once you've done that running the cc-buildloop target (or rebuild test) only executes what's left.

If I right-click (under Eclipse) IcqProtocolProviderSlick and select "debug jUnit test", I am not surprised to see it fails (no tests to run) because Oscar doesn't get started.

Indeed. All tests in the test directory require that both oscar and the SlickRunner are up and running.

If I right click TestAccountIstallation (which subclasses jUnit TestCase), it runs and fails because the properties are not setup.

Even if properties are set it would still fail because Oscar is not running and therefore there is no way to obtain a reference to the implementation that TestAccountInstallation is testing.

NetBeans actually uses the build.xml to run its debugger, so it is reasonable to expect the properties and classpaths to be the same. However, Eclipse does not run build.xml (or does it?). Can you give me any quick instructions on how to get started with debugging under Eclipse?

I have very limited experience with Eclipse but I know that the others are executing the cc-buildloop target.

By the way, I think most project developers use jBuilder...

I actually believe the majority are on Eclipse with me and Damian being the only exceptions.

are they currently debugging the individual slick's without problems?

I don't think there's any substantial difference. We always execute the same target and modify the lib/testing.properties file to keep only selected tests.

I agree that it would be a good idea to have an easy way of only starting tests related to the code you are currently working on. I remember that some time ago you refactored the test target in the build.xml to allow running single tests. I've just modified it very slightly to make it work. You can now run a single slick by executing (e.g.):

     ant test -Dtest.name=ConfigurationServiceLick

The pain is that even in this case all the slicks are loaded and their Activators start()-ed by oscar because they're still in the oscar.unit.test.properties file. Given that some of these tests take some time to start (e.g. the IcqProtocolProviderSlick which even performs network IO in its Activator start method) testing could still take longer than it is supposed to for a single test suite.

To further optimize timing one would have to go through the oscar.unit.test.properties file and remove the slicks that are unnecessary. Therefore if you are thinking of tackling this problem you'd better keep this in mind.

Hope this helps

Emil