Stelting - Testing
A good talk on the nature of testing an the options we have to test J2EE stuff. A great explanation of mock objects and using easymock. Good stuff.
Testing in the container vs testing outside the component.
Outside the container has the following downsides
1) requires test emulators
2) doesent provide container specfic service
3) know how it works mostly but not how it works in context
test code outside and components inside
1) relies on communication channel to container
2) cant use unit test j2ee components because they are not front facing
3) can be difficult to control test granularity because the ?front facing? components tend to be bigger
Test code, components inside the container
1) requires a trigger
2) test code depends on container services (some times we want this)
J2EE testing tech – vendors have lots of stuff
b) mock objects
JUnit is cool because its tightly integrated, not oriented towards testing J2EE components. JUnit is also the typical foundation of choice for more specialized testing frameworks (i.e. cactus, etc).
Doing example of testing a dao with a junit test showing the integration with NetBeans. Talked about setting up a connection via a factory so that you can return a connection outside a container.
Now talking about mock objects. Key concepts
1) create component,
2) create mock objects
3) call desired test behavior on component
4) set expectations/check output
Examples of doing mocks, good code bits.