File Exchange

image thumbnail

Automatic validation of software

version (3.07 KB) by Toby Driscoll
Validate software using a test library of functions in a directory.

1 Download

Updated 22 Jul 2008

View License

When developing a software package, it is useful to test changes by periodically running all the functions in a validation library. This function automates the process.

VALIDATE DIRNAME runs each M-file in the directory DIRNAME. Each M-file
should be a function that takes no inputs and returns a logical vector
or scalar. Three outcomes are possible:

'passed' All return values are true.
'failed' Some return value is false.
'crashed' Function threw an error.

A report is generated dynamically in the command window.

VALIDATE by itself tries to find a directory named 'validtests' in the
directory in which validate.m resides.

Cite As

Toby Driscoll (2021). Automatic validation of software (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Toby Driscoll

The line in the comment above was accidentally left over from the project that inspired the submission. I have removed it and the package should work now.

John D'Errico

This seems pretty good. In fact, it is a problem that we had to deal with in my previous job, validating large libraries of code.

I did find one line that caused some difficulty however. What is this? Both MATLAB and Google fail to find it.


I won't rate this code until the above question is resolved, since I can't test it. However, I'd probably have given the submission a fairly high rating. There is good help, the logical error checking, and the author has used tools like filesep and fullfile so the code will be insensitive to your particular operating system.

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!