Unit testing a PostGIS function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unit testing a PostGIS function

Adrien ANDRÉ
Hi all,

for simple code, appart from the main project, how may i perform unit
testing?


Looking at the source code structure [1], i wrote a simple function,
some queries using it and produced expected outputs to the following files:
.
├── function.sql
└── regress
     ├── function_expected
     └── function.sql

Not at ease with complex makefiles and not knowing the Perl language, i
simply tried comparing
psql -t -A -f regress/function.sql -o function_output
with
function_expected
using diff...

Is there a better way?


Thank you for any suggestion,

kind regards,

Adrien


[1] https://trac.osgeo.org/postgis/browser/trunk/regress
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Unit testing a PostGIS function

Nathan Wagner-2
On Thu, Dec 03, 2015 at 04:25:49PM +0100, Adrien ANDR?? wrote:

[snip]

> how may i perform unit testing?

[snip]

> i simply tried comparing
> psql -t -A -f regress/function.sql -o function_output
> with
> function_expected
> using diff...
>
> Is there a better way?

That's about how postgis and postgres test themselves.  You might also
look at pgtap at http://pgtap.org/ if you want something more formal.

--
nw
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users