Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Test Isolation with ScalaTest?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Esko Luontola  
View profile  
 More options Aug 23 2010, 6:35 pm
From: Esko Luontola <esko.luont...@gmail.com>
Date: Tue, 24 Aug 2010 01:35:52 +0300
Local: Mon, Aug 23 2010 6:35 pm
Subject: Re: [scalatest-users] Re: Test Isolation with ScalaTest?
Bill Venners wrote on 24.8.2010 0:00:

> If scala-library.jar is a problem then ScalaTest is out of the
> "running" for sure. But I actually don't understand what you mean
> here, and would like to. Can you clarify by giving a specific example
> of code you would want to "execute before the test class is
> instantiated?"

There's this line which passes the context to the test, so that the test
will know that which tests to execute on the current test run, and the
initialization in the Context.bootstrap() method:
http://github.com/orfjackal/specsy/blob/master/src/main/scala/net/orf...

It would be possible to detect when the class is instantiated the first
time by the framework (when no context has been prepared), but having to
deal with that special case would complicate the code needlessly. It
leads to a cleaner design when the test runner is separated from the
test class. Now calling the root spec (the test code in the constructor)
can be handled the same way as calling the nested specs - in
http://github.com/orfjackal/specsy/blob/master/src/main/scala/net/orf...
the bootstrap() method is for the root spec and the specify() method for
the nested specs - the only differences relate to changing the running
status.

Probably also writing tests for the testing framework code would be
harder, if the test runner would be coupled with the test class. Now I
can test the framework by just passing closures to the test runner (for
example
http://github.com/orfjackal/specsy/blob/master/src/test/scala/net/orf...)
instead of having to creating a dummy class whose constructor contains
the test code. There are only a couple of tests (for the JUnit runner
and the code itself which instantiates the classes) which require
concrete dummy classes as test data.

I suppose it basically boils down to this:
http://michaelfeathers.typepad.com/michael_feathers_blog/2010/08/test...

> I have a new question about after. Should multiple after clauses be
> allowed in a block, and if so, what order are they executed on exit?
> I'm guessing yes, and last registered first executed (i.e. executed in
> reverse order of appearance).  Is that what you do in Specsy?

Yes, that's how I do it. See the chapter "Before" and "After" Blocks in
http://github.com/orfjackal/specsy#readme

> This is
> another example of how such code would not be obvious to casual
> readers without reading the documentation, but again, it would likely
> be rare and could be well documented.

Specsy's documentation (http://github.com/orfjackal/specsy#readme) is
only about 4 pages long and it consists mostly of code examples (the
most valuable kind of documentation). I'm expecting everybody to read it
before using the framework.

--
Esko Luontola
www.orfjackal.net


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.