[Koha-devel] Unit tests and mock module

Travis Elliott Davis libsysguy at gmail.com
Fri Sep 7 15:42:31 CEST 2012


I have been writing some new unit tests and have had some success using Mock.  I have found that it allows me to have more control over some of the more unwieldy modules.

So +1 for Mock

On Sep 7, 2012, at 8:36 AM, Colin Campbell <colin.campbell at ptfs-europe.com> wrote:

> On Fri, Sep 07, 2012 at 02:41:18PM +0200, Paul Poulain wrote:
>> Hi Koha-devel,
>> 
>> I just pushed t/Members_AttributeTypes.t unit tests that fake the
>> database. The test here could be redundant with t/db_dependent tests
>> 
>> I feel we should be aware of that, and :
>> * decide Mock is the way to go, and promote using of Mock, removing
>> db_dependent tests (that fail if you don't have a database)
> Mocking the tests allows for more focused testing. The problem with the
> db_dependent tests is that so many variables get added to the mix.
> I think that we should recommend using Mock but due to the horrible
> jungle of dependencies in much of our code some things force us to use a
> db_dependent test
> C.
> 
> -- 
> Colin Campbell
> Chief Software Engineer,
> PTFS Europe Limited
> Content Management and Library Solutions
> +44 (0) 800 756 6803 (phone)
> +44 (0) 7759 633626  (mobile)
> colin.campbell at ptfs-europe.com
> skype: colin_campbell2
> 
> http://www.ptfs-europe.com
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/



More information about the Koha-devel mailing list