views:

55

answers:

2

Hi,

In my Python development, doctest has really helped both to

  • make writing unit tests less annoying, and
  • integrate usage examples with documentation.

I was wondering, is there anything like this available in the Matlab world? It doesn't have to literally use code comments as a test, but if it had those two desirable qualities, that would be great!

+1  A: 

There is no direct equivalent to doctest in MATLAB.

There is, however, a nice unit testing framework on the Matlab File Exchange.

Jonas
I've seen xUnit's existence.. I was really hoping for something that would integrate with documentation, though.
rescdsk
If I wrote a clone of `doctest` for Matlab, by your best guess, do you think others would be interested in using it?
rescdsk
I would think that this would have a decent chance of eventually making the `pick of the week` of the File Exchange. In other words: I believe that others would be very interested in this.
Jonas
+1  A: 

Not yet, but there is something to generate documentation called M2HTML.

It is very useful, and you can take a look at the examples at that page to see how wonderful results it's producing (even dependency graphs :) ).

For unit testing in MATLAB, even if there are many solutions, mlUnit was the most efficient to me.

A. Ionescu
I'm actually already using m2HTML, you're right, it's very good. I was hoping to be able to add usage examples that would be automatically validated, and test the code at the same time.Thanks for the mlUnit recommendation
rescdsk