unit testing

Monkey Forums/Monkey Programming/unit testing

wiebow(Posted 2011) [#1]
hi all,

I created a unit testing module for monkey. I am not really happy with the setup and casting needed at the moment (no monkey reflection, yet?) , so maybe you folks could have a look at the module and speak some words of wisdom.

link is here, as a download on a new code page I created: http://code.google.com/p/mutated-monkey/


wiebow(Posted 2011) [#2]
I also added the source to the repository.

Not one reply yet. Nobody is interested in this? That is too bad, I find unit testing extremely helpful. Anyway, I am going to use this while developing my game framework, smoothing it along the way.


matt(Posted 2011) [#3]
I've only just noticed it. I'll download, unzip and check it out when I can...


FlameDuck(Posted 2011) [#4]
What Matt said. Definitely looks like it could work, you just saved me a lot of time. Thanks for sharing. Project starred too, just in case I forget it later on.

If I might make a suggestion tho', make your repositories IDE neutral. :)


Samah(Posted 2011) [#5]
Just a quick warning: some of the functions in your assert.monkey conflict with Diddy's, so be careful what you import.

Example:
Import diddy
Import assert

Function Main:Int()
	AssertError("test")
	Return 0
End


Error : Duplicate identifier 'AssertError' found in module 'assert' and module 'assert'.


Very nice though. :)


wiebow(Posted 2011) [#6]
Thanks for the feedback!
If anyone has a better idea of how to make setting up the tests more easier (less code) then I would love to hear it. I worked around monkey's lack of reflection by using the test classes... but I am not REALLY happy with it.

If I might make a suggestion tho', make your repositories IDE neutral. :)

How would I do that? Or is it because of the Jungle project files? I will exclude them from future commits.

Just a quick warning: some of the functions in your assert.monkey conflict with Diddy's, so be careful what you import.

Well, I don't use Diddy so I wasn't aware of any conflict. I am going to
move the assert functions into a class though, I hope that helps.


ziggy(Posted 2011) [#7]
You don't need to change anything. If there's a clash you can prefix the functions/classes and any identifier with the name of the module (file) they're defined in, so clashes can be avoided properly.


wiebow(Posted 2011) [#8]
Yes, I forgot. Thanks.


wiebow(Posted 2011) [#9]
For those interested: I committed a new version of the unit testing module.
Today I created a vector2d module using unit tests and I'm happy with the changes (better messaging, slightly easier set-up of tests). I'll keep updating the unit test module as I go along. Next up is streamlining the suite so I can automate including tests from other modules.

The vector module and tests are uploaded as well so you can check out how things work. The vector module is guaranteed to work, cos I tested it! =]


wiebow(Posted 2012) [#10]
I'm updating this to use reflection for easy setup of tests... As soon as some reflection issues are solved I will update here.