On 10/15/09, etorreborre <etorr...@gmail.com> wrote:
>
> Mark,
>
> I committed my sbt project definition to svn (http://code.google.com/p/
> specs/source/checkout) so you should be able to run a "sbt
> test" (after maybe a tweak or two?).
I did 'update' and then 'compile' and I get some errors in
org/specs/runner/ScalaTest.scala around line 164 that look like that
code hasn't been updated for the Reporter in ScalaTest 1.0. If I
comment those out, I get some other errors related to overriding.
> Then you'll see that only 125 tests are executed on my project instead
> of the 1000+.
>
> As I wrote, it seems like the type of the class makes a difference in
> what is run and what is not. Is there a debug trace in sbt to see why
> a test class wasn't instantiated? I can see that all the test classes
> are tested for inclusion in the includeTest method but maybe,
> afterwards, there is an instantiation issue? You may also want to have
> a look at my org.specs.util.Classes trait which I use to instantiate
> Specification classes if that helps.
I think I have this fixed (in addition to fixes for ScalaCheck 1.6 and
ScalaTest 1.0). I'd like to test it on specs to be sure, though. Can
you take care of the compile errors?
Thanks,
Mark
On 10/15/09, Mark Harrah <dmha...@gmail.com> wrote:
> On 10/15/09, etorreborre <etorr...@gmail.com> wrote:
>>
>> Mark I fixed my sbt project so now everything compiles ok out of the
>> box and I get 125 tests being executed.
>
> Getting there... ScalaTest 1.0, specs 1.6, and ScalaCheck 1.6 should
> be supported in trunk now. specs tests that are classes should be
> supported, but that didn't get me up to 1000+ tests, only 225. I'll
> try again tomorrow.
There are a few problems that I have come across. First, the counting
granularity for sbt's specs support is too coarse- it is per class (or
whatever the top level is called in specs), not per example (again,
whatever it is called). That probably accounts for the lower number
of tests run than expected. I'll fix this.
Second, spex.Specification extends ScalaTest's Suite class, so sbt
picks up a subclass of spex.Specification as both a ScalaTest and
specs test and runs it once through specs and once through ScalaTest.
The tests that verify that certain code is only executed once then
fail. Not sure what to do about this one yet.
Third, Mockito doesn't clean up after its ThreadLocals, leading to
OOME: PermGen after a few 'test' executions. Not sure what to do
about this yet either.
-Mark
On 10/16/09, Bill Venners <bi...@artima.com> wrote:
> On Fri, Oct 16, 2009 at 4:57 PM, Mark Harrah <dmha...@gmail.com> wrote:
>> On 10/15/09, Mark Harrah <dmha...@gmail.com> wrote:
>> Second, spex.Specification extends ScalaTest's Suite class, so sbt
>> picks up a subclass of spex.Specification as both a ScalaTest and
>> specs test and runs it once through specs and once through ScalaTest.
>> The tests that verify that certain code is only executed once then
>> fail. Not sure what to do about this one yet.
>>
> I'd suggest that if a class is both an org.scalatest.Suite as well as
> some other kind of test framework you recognize, be it specs or JUnit
> or TestNG or something else, that in that case you don't run it with
> ScalaTest but with the other one, whatever it is. I tried to design
> ScalaTest so it could be integrated with other test frameworks, so
> people can get a uniform report from heterogeneous tests. The only
> other thing people might want is a single switch to say if it is both
> ScalaTest and something else, do the opposite: always run it with
> ScalaTest. But I'd wait on that until people ask and give you a good
> justification for such a knob. I'd think the default would be to just
> run with ScalaTest only when it is a Suite and nothing else you
> recognize.
In sbt, you declare your test frameworks in a list, so perhaps I
should just use the first framework that accepts the test. The
default could put specs before ScalaTest. Users could reorder the
list to match their preference.
>> Third, Mockito doesn't clean up after its ThreadLocals, leading to
>> OOME: PermGen after a few 'test' executions. Not sure what to do
>> about this yet either.
>>
> This is a problem for me in ScalaTest too. I think what we need to do
> is make a bug report to the Mockito project. I have never gotten
> around to it yet.
I'm never sure whether I diagnose PermGen errors properly until I
actually fix them, so it is good to know you tracked it down to the
same thing. I'll try to come up with a patch for this.
-Mark
The situation is improved if the three static ThreadLocals in Mockito
are replaced by synchronized WeakHashMaps keyed on the current Thread.
I can run 'test-only *propSpec*' more times before getting OOME:
PermGen and can continue to run tests successfully after getting the
OOME error (so it is probably now a soft OOME). It isn't the full
answer since the OOME still happens, but I think it shows that the
ThreadLocals are a problem.
-Mark
On 10/20/09, Mark Harrah <dmha...@gmail.com> wrote:
> I looked at the source for Mockito and it never clears the ThreadLocal
> in the source code, so I wouldn't expect reset to help.
>
> On 10/20/09, etorreborre <etorr...@gmail.com> wrote:
>>
>> Thanks Mark for the detailed explanation. I'm wondering if I could use
>> the reset method from mockito to avoid this phenomenon.
>>
>> I'll try that and tell you.
>>
I think this is a different problem. I'm not familiar with
ScalaTest's GUI runner, but if you can tell me how to reproduce the
problem, I'll take a look at it.
-Mark