-
1. Re: How to test a Seam component?
nbhatia.bhatian.comcast.net Dec 20, 2008 3:41 PM (in response to nbhatia.bhatian.comcast.net)Ok, I figured out that Integration Testing is documented in Chapter 34 of the reference manual - in the process of trying it out. However, a quick question - the example and the ComponentTest API suggest that we can only invoke methods with no parameters. Is it possible at all to test component methods that take parameters? If not, is the use of such methods discouraged? Why?
Thanks.
Naresh -
2. Re: How to test a Seam component?
matt.nirgue Dec 22, 2008 9:34 AM (in response to nbhatia.bhatian.comcast.net)Hi Naresh
Actually you can test methods with parameters but you can't use invokeMethod to do so...
You need to get your component first then call your method(s) like this:
SecurityService securityService = (SecurityService) getInstance(SecurityService.class); securityService.createUser("username", "pwd", "role");
-
3. Re: How to test a Seam component?
nbhatia.bhatian.comcast.net Dec 22, 2008 4:06 PM (in response to nbhatia.bhatian.comcast.net)Thanks so much Matt! I am now able to proceed with the test.
I would suggest (to committers) to add this way of invoking a test in the docs (section 34.2) - the docs gave me the impression that invokeMethod is the only way. Also it would be nice to clarify the advantage of using invokeMethod vs. getInstance() followed by a direct call (which seems more clearer to me).
Thanks again, Matt.