8

How do people working with XSB Prolog do unit testing? Is there a library available? Or is it possible to somehow use SWI-Prolog's plunit library in XSB?

If there is not an available testing library for XSB (or other Prologs no compatibles with plunit), maybe a variation of this question could be: How do you test your Prolog code ? Do you use a favorite pattern for testing it ?

false
  • 10,264
  • 13
  • 101
  • 209
Sergio
  • 8,532
  • 11
  • 52
  • 94
  • Perhaps a bit of explanation about "unit-testing" would encourage replies. I'm puzzled as to why a programmer needs a special tool for that. – hardmath Jun 19 '11 at 00:54
  • 1
    It isn't that a programmer "needs" a special library for unit testing. You can test as you wish using any technique you think is effective and efficient. However, it happens that this is a quite repetitive task, where you find yourself again and again defining fixtures, writing individual (unit) tests, using common testing expressions (I know this one is a bit arguable), defining cleaning tasks, and selecting one|a group|all of your tests to be executed. If there isn't a good existing library for this, you will have to define your own conventions and program support for these repetitive tasks. – Sergio Jun 19 '11 at 20:12

1 Answers1

2

After a bit of research I decided giving a try to lgtunit (http://logtalk.org/library/lgtunit_0.html), a Logtalk library for unit testing.

I found it quite easy to use and what I was looking for. A short tutorial can be found here: http://blog.logtalk.org/2011/03/writing-unit-tests-in-logtalk/

Sergio
  • 8,532
  • 11
  • 52
  • 94