Re: Unit tests and foreign key constraints

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Unit tests and foreign key constraints
Дата
Msg-id 20150521212920.GB18278@svana.org
обсуждение исходный текст
Ответ на Re: Unit tests and foreign key constraints  (Dave Owens <dave@teamunify.com>)
Список pgsql-general
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   <kleptog@svana.org>   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