|
From: Ian T. <Ia...@mo...> - 2008-09-01 13:02:35
|
Glad you found it helpful. Good luck with the testing! ________________________________ From: asu...@li... [mailto:asu...@li...] On Behalf Of mudit tuli Sent: 01 September 2008 13:50 To: Mailing List for the users of AsUnit Subject: Re: [Asunit-users] UnitTest a command in JumpShip framework ? Ian, thanks for this wonderful and helpful description, now I am enjoying writing the unit tests for my application. On Tue, Aug 26, 2008 at 2:54 PM, Ian Tyrrell <Ia...@mo...> wrote: Testing a command should be fine, but you should be mindful of its dependencies. Typically your command classes will invoke methods on other instances and you will want to assert that these methods have been called. If your command has dependencies on concrete classes, you will need to be able to access the instances of these classes within your fixture (test method). Remember that you only want to be testing the behavior of your class under test (i.e. your command class), not its dependencies (these should have their own unit tests). If the dependencies are 3rd party (or core) classes, you probably should be confident of their behavior. You either expect them 'just to work' OR they already have their own unit tests. Sometimes it's hard to assert the state of a dependency - this might be a sign of potential issues with your design. First step might be to refactor to interfaces or abstract classes. Alternatively you could just subclass your concrete class. If this all sounds too abstract, send me a copy of the class you want to test and I can give you an example (if you're worried about the sensitivity of the code, send it off list). Thanks, Ian ________________________________ From: asu...@li... [mailto:asu...@li...] On Behalf Of mudit tuli Sent: 25 August 2008 10:17 To: asu...@li... Subject: [Asunit-users] UnitTest a command in JumpShip framework ? Following from earlier comments by Ian Tyrrell -- >It's important to understand that ASUnit is a unit testing framework, >not an integration testing framework. > > It is designed to help verify behavior of a single unit of functionality > in your application, typically at single class/method level. > > It's not really appropriate if you want to test the end-to-end > functionality of your application. > >If you want to verify that when a user clicks a button a request is made >to the server, this would be an integration test. So, I am now focusing to unit-test individual components. I am using Jumpship framework : 1. The framework follows the Command Pattern 2. A controller function is called on command completion. Is it possible to unit-test a Command, or do I need to break down further? ------------------------------------------------------------------------ - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Asunit-users mailing list Asu...@li... https://lists.sourceforge.net/lists/listinfo/asunit-users |