From: brett l. <bre...@gm...> - 2012-06-06 21:04:34
|
Typically, the test code and the application code are separate entities. Ideally, all tests and mocked objects should be off to the side in a 'test/' directory. This way, they are in the same repository, but can be removed from the released JARs and not cause unnecessary bloat. ---Brett. On Wed, Jun 6, 2012 at 4:27 PM, Erik Vos <eri...@xs...> wrote: > This all is way beyond my understanding, but if the two of you say that it's useful, I'm fine. > Just wondering with what factor this will multiply the size of the Rails code. > > Erik. > >> -----Original Message----- >> From: brett lentz [mailto:bre...@gm...] >> Sent: Wednesday, June 06, 2012 7:07 PM >> To: Development list for Rails: an 18xx game >> Subject: Re: [Rails-devel] Mocking library chosen >> >> I have no objections to Mockito. >> >> One thing I'd like to see is just a central mocked data set that we can use for >> exercising the code. Eventually, it would be nice to grow our test case >> coverage. >> >> ---Brett. >> >> >> On Wed, Jun 6, 2012 at 12:33 PM, Stefan Frey <ste...@we...> wrote: >> > Erik & Brett: >> > recently I have mailed that I would like to add a mock library to >> > support testing. At that time I preferred JMock (mostly above EasyMock). >> > However I did reevaluate my choice again and realized that the library >> > that suited my tastes best is Mockito. >> > see http://code.google.com/p/mockito/ >> > >> > Checkout the documentation at >> > http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html >> > which really shows very well the very simple but powerful style used. >> > >> > Or compare to the first test example which I have pushed to the >> > rails2.0 branch (ActionChangeTest.java) in the junit folder with the >> > identical hierachy as rails below (the source code itself is under src folder). >> > >> > It is really easy to create mock objects by simply annotate private >> > fields in the test classes with @Mock or directly with Player player = >> > mock(Player.class) >> > >> > Verifying that a method of the mock is called (once) requires: >> > verify(mock).method() >> > >> > And stubbing a method of the mock is initialized with: >> > when(mock.method()).thenReturn(value) >> > >> > Avoiding using strings also ensures that autocompletion of Eclipse-IDe >> > still works. >> > >> > This syntactical sugar simplifies unit tests substantially (at least >> > in my opinion). >> > >> > Stefan >> > >> > ---------------------------------------------------------------------- >> > -------- >> > Live Security Virtual Conference >> > Exclusive live event will cover all the ways today's security and >> > threat landscape has changed and how IT managers can respond. >> > Discussions will include endpoint security, mobile security and the >> > latest in malware threats. >> > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> > _______________________________________________ >> > Rails-devel mailing list >> > Rai...@li... >> > https://lists.sourceforge.net/lists/listinfo/rails-devel >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and threat >> landscape has changed and how IT managers can respond. Discussions will >> include endpoint security, mobile security and the latest in malware threats. >> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |