Are there unit testing scripts or provisions for RouterOS code?

In my day-to-day life as software developer I do a lot of unit testing mostly using xUnit like or derived frameworks even for scripting.

So: are there any kinds of RouterOS scripts available to help with unit testing?

Various search attempts didn’t reveal any to me yet.

–jeroen

RouterOS scripting is too “simple” (as in… “not good”) for a unit testing framework to be reliably written in it, which in turn means there’s no viable way to internally do such tests.

You could use the API to do that, i.e. run scripts to run, then analyze their output, and use assertions and reports within your language of choice, as opposed to generating them with the router. That’s the best approach today.

I realize resetting the router state is a big problem with the above (and also why unit testing frameworks aren’t a trivial thing to write)… You could create a clean VM, and then clone it before each test session.

Unit Testing should be sort of stateless (to me that would mean only test functions input and output, no procedures).

Even shell scripts have unit testing now, for instance at https://github.com/kward/shunit2/tree/master/source/2.1/src

I’m not going to dig into the API yet (I try to keep the # of technologies involved small), but thanks for the tips so far.

–jeroen