Jonathan and I are in the progress of coding up a JUnit template for session beans. We have something that 'works' in some simple cases at least.
It generates a test for every method on the session bean. The initial values was a problem, but I did cheap guess. For DTO's I used the default constructer 'new SomeDTOClass()' and for primitive values I made some best guesses. You can have a look at: src/sample/project-template/ejbTemplate/src/templates It certainly could be better, but it's a start. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Jan > Kester > Sent: Wednesday, March 26, 2003 9:04 AM > To: [EMAIL PROTECTED] > Subject: [Andromda-user] testcases > > > Tony, Jonathan > > I read something a few days ago that you were writing some templates for > junit testcases. I was thinking of the same and would like exchange some > ideas. > I had in mind that whenever I create a session bean, that each > public method > of this bean should get a test method. Of course by far not suficient, one > method may already need many tests, but a good start to setup a project > structure. All sessionbeans should preferibly talk with the (client) > business delegate via data transfer objects. These data transfer > objects are > usually not the same as the entity beans, but will be a combination of > entity data and other data needed in the sessionbean calculations. My best > guess would be to create the DTO classes in the uml diagram, give > them a new > stereotype and create with a template the get-and-set methods. How the DTO > inside the sessionbean will be split/combined to entity bean value objects > is business logic to be filled in, cannot be generated in advance. But the > access to the sessionbean�s public methods should be possible. > Now comes the difficulty that I foresee: from the junit testcase > one should > call the business delegate with the proper data objects. This could be > strings, ints, etc., but also objects that exist of objecst. How can these > be filled with initial values? My guess was to make a TestDataFiller class > that receives an object and by reflection scans the test values > needed. The > junit testcases would then call this class to fill the public method with > the proper data. > > What do you think? > > Regards, Jan > > > > Jan Kester > Marlborough Stirling Espa�a, S.L. Director de Inform�tica > Gran V�a 62, 10� izq > 28013 Madrid > tel: +34-91-5487910 > fax: +34-91-5400199 > email: [EMAIL PROTECTED] > > > > ------------------------------------------------------- > This SF.net email is sponsored by: > The Definitive IT and Networking Event. Be There! > NetWorld+Interop Las Vegas 2003 -- Register today! > http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en > _______________________________________________ > Andromda-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/andromda-user ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user
