Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseEasyMock


Difference between version 4 and version 1:

At line 3 changed 1 line.
This articel will give a short overview how to integrate EasyMokc in AppFuse.
This articel will give a short overview how to integrate EasyMock in AppFuse.
For further questions you can contact me at josip(at)esistegalaber(dot)de
At line 190 changed 1 line.
I think this form of mocking your test is very simple to understand. The MockControl simply keeps track of the calls you make to the mocked instance. This way it becomes very easy to write down your expectations and the rather complicated setup of expectaions using bare Mocks is not needed anymore. Just like with bare Mocks you can set (void) return values or exceptions to be thrown. There are even convenience methods to specify that a method i supposed to be called n times. For more information on what EasyMock can do for you visit the EasyMock [Documentation|http://www.easymock.org/Documentation.html].
I think this form of mocking your test is very simple to understand. The MockControl simply keeps track of the calls you make to the mocked instance. This way it becomes very easy to write down your expectations and the rather complicated setup of expectations using bare Mocks is not needed anymore. Just like with bare Mocks you can set (void) return values or exceptions to be thrown. There are even convenience methods to specify that a method i supposed to be called n times. For more information on what EasyMock can do for you visit the EasyMock [Documentation|http://www.easymock.org/Documentation.html].
At line 203 changed 1 line.
I consider Mocks to be a bit more than just a means of [White Box Tests|http://en.wikipedia.org/wiki/White_box_testing]. As the term itself indicates you need to have some knowlegde of the tested code in order to write a meaningful test. In contrast to [Black box Tests|http://en.wikipedia.org/wiki/Black_box_testing] where you don't care about the code itself, but only about the outcome of the test it will give you some information about the code you wrote. So, as a rule of thumb I belive that if you have difficulties writing a mock test for you business object that simply means your business object is designed badly. Therefore my paradigm concerning mock tests is simply:\\__"If you can't test it - refactor it!"__.\\Comments appreciated!

Back to AppFuseEasyMock, or to the Page History.