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:
> 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