'mock'에 해당되는 글 2건

  1. 2010/06/07 mock vs stub (1)
  2. 2006/12/24 EasyMock vs Jmock (8)

2010/06/07 23:18 Developer

mock vs stub

개념만 이해를 하고 있고, 설명을 하려니 그림/표가 부족해서 정리 잘 된 문서 몇개 정리를 해봤다.



mock

mock object http://www.c2.com/cgi/wiki?MockObject

mock aren't stubs http://martinfowler.com/articles/mocksArentStubs.html

mock roles, not object http://www.jmock.org/oopsla2004.pdf

mock vs stub

http://weblogs.asp.net/rosherove/archive/2007/09/16/mocks-and-stubs-the-difference-is-in-the-flow-of-information.aspx
  • Stubs provide input for the application under test so that the test can be performed on something else.
  • Mocks provide input to the test to decide on pass\fail. the opposite direction.

image 

A stub can never fail a test.


xunit patterns http://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html

Terminology Cross-Reference

I'm listing some sources of conflicting definitions just to make it clear what the mapping is to my pattern names:



Sources and Names Used in them
PatternAstelsBeckFeathersFowlerjMockUTWJOMGPragmaticRecipes
Test Double






Double or stand-in
Dummy ObjectStub


Dummy


Stub
Test StubFake
FakeStubStubDummy
MockFake
Test Spy




Dummy

Spy
Mock ObjectMock
MockMockMockMock
MockMock
Fake Object




Dummy


Temporary Test Stub




Stub


OMG's CORBA Stub





Stub

Posted by ologist
 TAG mock

2006/12/24 13:15 Developer

EasyMock vs Jmock

테스트의 중요성이 날이 갈수록 더 중요해지고 있는 시점에 FakeObject인 Mock객체에 대한 관심도 높아지고 있다. 나도 TestCase를 Refactoring을 하면서 Mock사용을 증가하고 있는 시점이다.

일반적으로 개발자들이 선택하는 mock라이브러리는 EasyMock하고 Jmock이다. 둘다 예제를 보니 잘 되어있다.

Human Interface, FluentAPI로 된 Jmock은 코드가 간결하고 사용하기도 쉽고, 이해하기 쉽다는 강점이 있지만, 메소드 네임이 string기반이라 refactoring에 치명적인 약점을 보이고 있다.

특히, 나같이 클래스 이름이나 메소드 이름을 자주 바꾸는 사람은 매번 테스트 케이스가 깨지면서 고치는 일이 많아질 것이다.

rename refactoring을 많이 사용하는 나는 일단, EasyMock을 조심히 선택을 해본다.

PS.
근데, 인간적으로 Jmock API 이쁘다!!
Posted by ologist
 TAG mock
이전버튼 1 이전버튼

블로그 이미지
ologist

공지사항

Yesterday191
Today136
Total34,708

달력

 « |  » 2012.02
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

최근에 받은 트랙백

글 보관함