Does anyone know how to create TDD for Free Pascal? I tried the built-in fpcunit, but I couldn’t find any good documentation on the subject and I couldn’t get it to work (perhaps due to my lack of experience). I only found information about Lazarus (I didn’t tested it), but I think it’s logical to completely remove this dependency from Free Pascal Track (or rename it to Lazarus like Delphi track).
There is an active german community around Free Pascal, but they also seem to “ignore” unit testing. This repository seems to be the most recent one using (and provides an extension to) fpcunit for testing. This might help with getting a grip on how it should work.
There also is FPTest metioned in the Free Pascal wiki, but I also have no idea how to make that work. It seems unmaintained (or maybe it is “done” and needs no changes?). But they have documentation and examples in docs/, so it might be a better starting point.
It really is a long time since I wrote Pascal programs (it may have been well before 2000, but I don’t remember exactly). Back then it also was a problem that there was no or little documentation to the library modules, and the libraries came pre-compiled. So we very often ended up writing our own solution…
PS: Please do not say “create TDD”. TDD is a process you do, which includes unit testing. You can create unit tests, or a test runner.
Thanks for replying!
I tried that too. I couldn’t get it to work, even after reading the documentation and trying to figure out the code.
But I haven’t completely given up on FPCunit or FPTest.
In the meantime, I found a recent and easy-to-use TAP library:
my “free-pascal-track-demo-from-scratch” repository with zero Lazarus or any other “non-free-pascal” dependency are advancing now
.
And I’m just a newbie with rusty and old student skills…
Grammar lessons! I’m very glad! Thanks ![]()
As opposed to cementics, which is more concrete.
Just an update,
I finally managed to make a working example using the built-in FPCUnit, and I was also able to use an old file called uShare.pas, which is a custom JUnit-compatible XML output format, I think, the output could be parsed at JUnit Parser , but the xml differs a little from the Common JUnit XML Format & Examples, I not too familiar with JUnit so I don’t know it’s the differences are really relevant.
Using the TAP library I was metioned, I facing dificulty to extend such simple library and produce valid multiline tap output too. By using FPCUnit, I not only get to use an extensible and customizable builtin, but I can also create valid multiline TAP output with seemingly less effort than trying to extend the external TAP library I’m currently using. These issues have become more glaring now that I’m trying to learn about the test runner…