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
SpringJUnit4ClassRunner coming?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
rossputin  
View profile  
 More options Sep 20 2009, 7:56 am
From: rossputin <rossaj...@gmail.com>
Date: Sun, 20 Sep 2009 04:56:41 -0700 (PDT)
Local: Sun, Sep 20 2009 7:56 am
Subject: SpringJUnit4ClassRunner coming?
Hi Guys.

I am happily using the JUnitRunner to integrate my scalatests with
Maven.  Is there a plan to implement the bridge to
SpringJUnit4ClassRunner, or is that something I should be able to work
out how to do?

Thanks in advance for your help,
 -- Ross


 
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.
Jon-Anders Teigen  
View profile  
 More options Sep 20 2009, 8:31 am
From: Jon-Anders Teigen <jtei...@gmail.com>
Date: Sun, 20 Sep 2009 14:31:27 +0200
Local: Sun, Sep 20 2009 8:31 am
Subject: Re: [scalatest-users] SpringJUnit4ClassRunner coming?
Hi Ross,

I would rather do that as a trait that can be mixed into any Suite and  
used everywhere, no matter what you use to run your tests

If I remember correctly, the old AbstractSpringDependencyInjectionTest  
(or whatever long and 'spring-like' name it had) worked like this:
=> junit creates an instance of the class
=> spring creates an applicationcontext given your configuration files  
(caches it in static field for later use)
=> autowires 'this' instance (your testclass) either by type or by  
name, injecting stuff into your setter methods
=> and then your test runs

the new SpringJUnit4ClassRunner can probably do some more magic as it  
is also responsible for creating the instance of your testclass.
If you require to wire by constructor, then I think you will need to  
write your own runner (shouldnt be that difficult as both the  
SpringRunner and the scalatest JunitRunner are simple and readable)
Or if you are ok with wiring through setter methods you can write a  
trait replicating the behaviour you need from the  
AbstractSpringDependencyInjectionTest. The best part of this approach  
is that your trait can be mixed into every scalatest you write no  
matter how you choose to run it (commandline, gui runner, ant, maven,  
sbt, buildr ...)
The reason for this is that they all require scalatest suites to have  
a no-arg default constructor.

/j

On 20. sep.. 2009, at 13.56, rossputin wrote:


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »