You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Tiago Espinha <ti...@espinhas.net> on 2009/06/05 13:08:08 UTC
Issue with JUnit - 0 tests?
Hello everyone,
Has anyone ever faced an issue when running JUnit tests where no fixtures
from a test are ran?
Here's what I get exactly:
------------------8<-------------------------
C:\cygwin\home\Tiago\Derby\Testing\TempTest>java junit.textui.TestRunner
org.apa
che.derbyTesting.functionTests.tests.derbynet.NetworkServerControlClientCommandT
est
Time: 0
OK (0 tests)
-------------------8<--------------------------
The odd part is that this test was running (and failing) yesterday, and now
it acts as if there are no fixtures in the file. I'm looking at the file in
Eclipse, and there is the testPing() fixture in it. I've also done ant
clobber, all and buildjars more than once with no luck. What's even more
odd, is that with the very same patch (the latest on DERBY-4217), if I try
to run this test on an Ubuntu Virtual Machine, it does run the one fixture
in it.
Does anyone have any idea of what's going on here?
Best Regards,
Tiago
Re: Issue with JUnit - 0 tests?
Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Tiago Espinha <ti...@espinhas.net> writes:
> Hello Knut,
>
> Well, I do think this test should be ran regardless of the locale since it's a
> generic test that configures ports for the client/server through different
> methods (derby.properties and -p switch) and then tries to ping the server.
> Hardly something bound to a specific locale.
>
> However, this probably must be done with caution and I think I know why this
> locale check is in place. Basically some asserts have hardcoded strings to
> check for a failed ping. Like:
>
> assertFailedPing(pingCmd1, "Could not connect to Derby Network Server");
>
> Although, you said that we could set the default locale to US and then switch
> it back at the end of the test. That probably will also fix this caveat.
>
> Do you think I should include this in my derby.tests.port patch for DERBY-4217
> or should I create an issue for it?
Hi Tiago,
I don't think it should be part of the DERBY-4217 since it's not really
the same issue. Feel free to go ahead and file a new one. We can discuss
there what's the best way to make the test run in all locales, whether
it's by temporarily changing the default locale or by making the asserts
locale insensitive. I haven't looked at the test yet, so I haven't made
up my mind.
Thanks,
--
Knut Anders
Re: Issue with JUnit - 0 tests?
Posted by Tiago Espinha <ti...@espinhas.net>.
Hello Knut,
Well, I do think this test should be ran regardless of the locale since it's
a generic test that configures ports for the client/server through different
methods (derby.properties and -p switch) and then tries to ping the server.
Hardly something bound to a specific locale.
However, this probably must be done with caution and I think I know why this
locale check is in place. Basically some asserts have hardcoded strings to
check for a failed ping. Like:
assertFailedPing(pingCmd1, "Could not connect to Derby Network Server");
Although, you said that we could set the default locale to US and then
switch it back at the end of the test. That probably will also fix this
caveat.
Do you think I should include this in my derby.tests.port patch for
DERBY-4217 or should I create an issue for it?
Tiago Espinha
On Sat, Jun 6, 2009 at 7:52 AM, Knut Anders Hatlen <Kn...@sun.com>wrote:
> Tiago Espinha <ti...@espinhas.net> writes:
>
> > Thanks to Kathey, we were able to find out the problem and the
> > solution for the issue. It turns out that the test has the following
> > check on the suite() method:
> >
> > if (!Derby.hasServer() ||
> > !Locale.getDefault().getLanguage().equals("en") ||
> > JDBC.vmSupportsJSR169())
> >
> > Since the locale on my machine is probably set to Portuguese, it
> > wouldn't run the test at all. The solution was to override the locale
> > with the following properties:
> >
> > -Duser.language=2-char-language-code -Duser.region=2-char-country-code
> >
> > Set it to any anglophone country, with the respective 'en' language
> > code and it all starts working.
>
> Hi Tiago,
>
> Do you think it would make sense for this test to call
> Locale.setDefault(Locale.US) in setUp() and reset the locale in
> tearDown()? Something similar is done in SysinfoLocaleTest. If we do
> so, we should probably factor it out in a separate decorator class to
> make it easier to use in other tests later.
>
> --
> Knut Anders
>
Re: Issue with JUnit - 0 tests?
Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Tiago Espinha <ti...@espinhas.net> writes:
> Thanks to Kathey, we were able to find out the problem and the
> solution for the issue. It turns out that the test has the following
> check on the suite() method:
>
> if (!Derby.hasServer() ||
> !Locale.getDefault().getLanguage().equals("en") ||
> JDBC.vmSupportsJSR169())
>
> Since the locale on my machine is probably set to Portuguese, it
> wouldn't run the test at all. The solution was to override the locale
> with the following properties:
>
> -Duser.language=2-char-language-code -Duser.region=2-char-country-code
>
> Set it to any anglophone country, with the respective 'en' language
> code and it all starts working.
Hi Tiago,
Do you think it would make sense for this test to call
Locale.setDefault(Locale.US) in setUp() and reset the locale in
tearDown()? Something similar is done in SysinfoLocaleTest. If we do
so, we should probably factor it out in a separate decorator class to
make it easier to use in other tests later.
--
Knut Anders
Re: Issue with JUnit - 0 tests?
Posted by Tiago Espinha <ti...@espinhas.net>.
Thanks to Kathey, we were able to find out the problem and the
solution for the issue. It turns out that the test has the following
check on the suite() method:
if (!Derby.hasServer() ||
!Locale.getDefault().getLanguage().equals("en") ||
JDBC.vmSupportsJSR169())
Since the locale on my machine is probably set to Portuguese, it
wouldn't run the test at all. The solution was to override the locale
with the following properties:
-Duser.language=2-char-language-code -Duser.region=2-char-country-code
Set it to any anglophone country, with the respective 'en' language
code and it all starts working.
Tiago
On Fri, Jun 5, 2009 at 1:19 PM, Tiago Espinha <ti...@espinhas.net> wrote:
>
> Well, they both are there (and I also checked that the jars were in their directory), along with the rest of all the jars. I have been using the same set of commands to set the classpath so this shouldn't be it...
>
> On Fri, Jun 5, 2009 at 1:14 PM, Kathey Marsden <km...@sbcglobal.net> wrote:
>>
>> Tiago Espinha wrote:
>>>
>>> Hello everyone,
>>>
>>> Has anyone ever faced an issue when running JUnit tests where no fixtures from a test are ran?
>>>
>> I think if derbynet.jar and derbyclient.jar are not in the classpath, the network tests will be skipped. Could this be it?
>>
>>> Here's what I get exactly:
>>> ------------------8<-------------------------
>>> C:\cygwin\home\Tiago\Derby\Testing\TempTest>java junit.textui.TestRunner org.apa
>>> che.derbyTesting.functionTests.tests.derbynet.NetworkServerControlClientCommandT
>>> est
>>>
>>> Time: 0
>>>
>>> OK (0 tests)
>>> -------------------8<--------------------------
>>>
>>> The odd part is that this test was running (and failing) yesterday, and now it acts as if there are no fixtures in the file. I'm looking at the file in Eclipse, and there is the testPing() fixture in it. I've also done ant clobber, all and buildjars more than once with no luck. What's even more odd, is that with the very same patch (the latest on DERBY-4217), if I try to run this test on an Ubuntu Virtual Machine, it does run the one fixture in it.
>>>
>>> Does anyone have any idea of what's going on here?
>>>
>>> Best Regards,
>>> Tiago
>>
>
Re: Issue with JUnit - 0 tests?
Posted by Tiago Espinha <ti...@espinhas.net>.
Well, they both are there (and I also checked that the jars were in their
directory), along with the rest of all the jars. I have been using the same
set of commands to set the classpath so this shouldn't be it...
On Fri, Jun 5, 2009 at 1:14 PM, Kathey Marsden
<km...@sbcglobal.net>wrote:
> Tiago Espinha wrote:
>
>> Hello everyone,
>>
>> Has anyone ever faced an issue when running JUnit tests where no fixtures
>> from a test are ran?
>>
>> I think if derbynet.jar and derbyclient.jar are not in the classpath, the
> network tests will be skipped. Could this be it?
>
>
> Here's what I get exactly:
>> ------------------8<-------------------------
>> C:\cygwin\home\Tiago\Derby\Testing\TempTest>java junit.textui.TestRunner
>> org.apa
>>
>> che.derbyTesting.functionTests.tests.derbynet.NetworkServerControlClientCommandT
>> est
>>
>> Time: 0
>>
>> OK (0 tests)
>> -------------------8<--------------------------
>>
>> The odd part is that this test was running (and failing) yesterday, and
>> now it acts as if there are no fixtures in the file. I'm looking at the file
>> in Eclipse, and there is the testPing() fixture in it. I've also done ant
>> clobber, all and buildjars more than once with no luck. What's even more
>> odd, is that with the very same patch (the latest on DERBY-4217), if I try
>> to run this test on an Ubuntu Virtual Machine, it does run the one fixture
>> in it.
>>
>> Does anyone have any idea of what's going on here?
>>
>> Best Regards,
>> Tiago
>>
>
>
Re: Issue with JUnit - 0 tests?
Posted by Kathey Marsden <km...@sbcglobal.net>.
Tiago Espinha wrote:
> Hello everyone,
>
> Has anyone ever faced an issue when running JUnit tests where no
> fixtures from a test are ran?
>
I think if derbynet.jar and derbyclient.jar are not in the classpath,
the network tests will be skipped. Could this be it?
> Here's what I get exactly:
> ------------------8<-------------------------
> C:\cygwin\home\Tiago\Derby\Testing\TempTest>java
> junit.textui.TestRunner org.apa
> che.derbyTesting.functionTests.tests.derbynet.NetworkServerControlClientCommandT
> est
>
> Time: 0
>
> OK (0 tests)
> -------------------8<--------------------------
>
> The odd part is that this test was running (and failing) yesterday,
> and now it acts as if there are no fixtures in the file. I'm looking
> at the file in Eclipse, and there is the testPing() fixture in it.
> I've also done ant clobber, all and buildjars more than once with no
> luck. What's even more odd, is that with the very same patch (the
> latest on DERBY-4217), if I try to run this test on an Ubuntu Virtual
> Machine, it does run the one fixture in it.
>
> Does anyone have any idea of what's going on here?
>
> Best Regards,
> Tiago