dev@glassfish.java.net

Re: why won't my unit tests run?

From: Jason Lee <jasondlee_at_sun.com>
Date: Thu, 30 Jul 2009 16:12:29 -0500

I think that's the default for JUnit. It's configurable, fwiw.

On Jul 30, 2009, at 3:53 PM, Lloyd Chambers wrote:

> That's it!
>
> I assumed that classes in the src/test directory would be examined
> for @Test methods. Grrr....
>
> On Jul 30, 2009, at 1:40 PM, Justin Lee wrote:
>
>> Some projects i've worked on look for files named like
>> FooTest.java. Try renaming your class to that it ends with "Test"
>>
>> Lloyd Chambers wrote:
>>> Even more mysterious—
>>>
>>> I do have some tests that are being run in common/amx-core-imp.
>>>
>>> But when I duplicate one of those tests, changing nothing but the
>>> classname, the new test compiles and is in target/test-classes,
>>> but it is ignored, and never run.
>>>
>>> I can't find any file that lists tests by name or anything of that
>>> sort.
>>>
>>> Lloyd
>>>
>>> On Jul 30, 2009, at 1:08 PM, Lloyd Chambers wrote:
>>>
>>>> Is there some trick to getting a junit test to run for a module
>>>> during build?
>>>>
>>>> Adding a test does not seem to run. Here's a dummy I tried
>>>> ("There are no tests to run").
>>>>
>>>> llcMP:amx-core llc$ ls src/test/java/org/glassfish/admin/amx/test/
>>>> core
>>>> OtherTests.java
>>>>
>>>>
>>>> package org.glassfish.admin.amx.test.core;
>>>>
>>>> import org.junit.Test;
>>>>
>>>> public final class OtherTests {
>>>> public OtherTests()
>>>> {
>>>> }
>>>>
>>>> @Test
>>>> public void testDummy() {
>>>> }
>>>> }
>>>>
>>>> It doesn't look any different than ImmutableTest in glassfish-api:
>>>>
>>>> package org.glassfish.api.tests;
>>>>
>>>> import org.junit.Test;
>>>> import junit.framework.Assert;
>>>> import org.glassfish.api.event.EventTypes;
>>>>
>>>> public class ImmutableTest {
>>>> @Test
>>>> public void test1() {
>>>>
>>>> EventTypes evt1 = EventTypes.create("foo");
>>>> EventTypes evt2 = EventTypes.create("foo");
>>>> EventTypes evt3 = EventTypes.create("foo34");
>>>>
>>>> Assert.assertNotSame(evt1, evt3);
>>>> Assert.assertEquals(evt1, evt2);
>>>>
>>>> Assert.assertTrue(evt1==evt2);
>>>> Assert.assertFalse(evt1==evt3);
>>>> }
>>>>
>>>> }
>>>
>>> Lloyd Chambers
>>> lloyd.chambers_at_sun.com
>>> GlassFish Team
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> Lloyd Chambers
> lloyd.chambers_at_sun.com
> GlassFish Team
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>

         Jason Lee
Senior Java Developer
GlassFish Administration Console

Sun Microsystems, Inc.
Phone x31197/+1 405-343-1964
Email jasondlee_at_sun.com
Blog http://blogs.sun.com/jasondlee
Blog http://blogs.steeplesoft.com