Re: Unit tests and foreign key constraints

Поиск
Список
Период
Сортировка
Искать
От
Martijn van Oosterhout
Тема
Re: Unit tests and foreign key constraints
Дата
в 21:29:02
Msg-id
20150521212920.GB18278@svana.org
Ответ на
Список
Дерево обсуждения
Unit tests and foreign key constraints Andy Chambers <achambers.home@gmail.com>
Re: Unit tests and foreign key constraints Martijn van Oosterhout <kleptog@svana.org>
Re: Unit tests and foreign key constraints Andy Chambers <achambers.home@gmail.com>
Re: Unit tests and foreign key constraints Dave Owens <dave@teamunify.com>
Re: Unit tests and foreign key constraints Martijn van Oosterhout <kleptog@svana.org>
On Thu, May 21, 2015 at 01:33:46PM -0700, Dave Owens wrote:
> >
> > I know some say your unit tests shouldn't touch the DB but the more full
> > stack tests I have, the better I sleep at night :-))
> >
> 
> Unit tests really should be about testing individual bits of logic.  Does a
> single method do the desired thing, and not the undesired thing...
> Ideally, your data access layer should be interchangeable, ie: use a real
> database record in production, but use a mock database record for unit
> tests.

Nice in theory. But if you use Postgres features like timestamptz
calculations and hstore, it's generally way easier to run your unit
tests on an actual PostgreSQL database.  Otherwise you're going to spend
all your time working around the fact that your mock database is not
the real thing (and running into bugs in your emulation layer).

Have a nice day,
-- 
Martijn van Oosterhout      http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
   -- Arthur Schopenhauer
В списке pgsql-general по дате отправления
От: Karsten Hilbert
Дата:
Сообщение: Re: date with month and year
От: Paul Jungwirth
Дата:
Сообщение: Re: date with month and year
FAQ