UnitTesting - Using AsUnit, how to "inject" proper dependancies when running tests?

Jos Yule's Avatar

Jos Yule

29 Nov, 2009 03:39 AM

Hello all.

When i'm running my tests, how do i ensure that my dependancies are 'injected'? I can manually inject them in the setUp() function, is this the way it would normally be done?

Any suggestions would be appreciated!

jos

ps. I'm using Sprouts for automating a bunch of this stuff, but the question is still primarily an AsUnit/Robotlegs/DI question.

  1. Support Staff 1 Posted by Joel Hooks on 29 Nov, 2009 03:43 AM

    Joel Hooks's Avatar

    You are on the right track Jos. You want to unit test your classes outside of the framework (in isolation), so manually providing the dependencies is the way to go. Otherwise you'd need to set up the injection rules in your tests, which would be just as verbose (and in the realm of integration testing, imo).

  2. 2 Posted by Jos Yule on 29 Nov, 2009 03:52 AM

    Jos Yule's Avatar

    Ok, great, that's very straight forward.

    Thanks again,
    jos

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac