Browse Source

README update

master
Markus Bergholz 7 years ago
parent
commit
82c74555ba
  1. 69
      README.md
  2. 6
      mUnittest.m

69
README.md

@ -1,7 +1,70 @@
# mutest
# mUnittest
* uniform unittest framework for GNU Octave and Matlab
* `mUnittest('testscript')` will create `testscriptReport.xml` which is designed to work with Jenkins JUnit publish plugin.
* `mUnittest()` is compatible with `runtests()` of mathworks.
* `mUnittest('testscript')` will create `testscriptReport.xml` which is designed to work with Jenkins JUnit publish plugin. See
[Showcase with Jenkins](https://github.com/markuman/mUnittest/wiki/Showcase-with-Jenkins)
* `mUnittest()` is compatible with `runtests()` of Matlab >= R2014a.
## assert
The core of `mUnittest` is an overloaded `assert()` function. It works as the buildin `assert` up to the usage of the optional
messages.
### no messages
assert(cond)
`cond` _(condition)_ has to be `1` or `true`, otherwhise the `assert` will fail.
When no message is given, it gets the name of the testscript itself. E.g. given `testscript.m` contains
assert(0 == 1);
Running this mUnittest will looks like this
octave:1> mUnittest('testscript');
mUnittest: testscript
1 failed testscript_1
PASSED 0 OF 1
The message will be in this case `testscript_1` while the failure message of the `testscriptReport.xml` will be
<failure type="assert"> Test 1 failed </failure>
### messages
assert(cond, messageName, messageError)
You can name each `assert` test with the first messageName and a messageError. It will appears in Jenkins like that
assert(false, 'AnotherTest', 'I''m a possible reason why I failed')
... will look like this
octave:1> mUnittest('testscript');
mUnittest: testscript
1 failed AnotherTest
PASSED 0 OF 1
`testscript.AnotherTest` with failure tree `I'm a possible reason why I failed`.

6
mUnittest.m

@ -1,7 +1,7 @@
function ret = mUnittest(script)
%mutest - simply matlab unittest framework
% designed to have one uniform framework for GNU Octave and Matlab
%mUnittest - uniform unittest framework for GNU Octave and Matlab
% the created .xml Reports are designed to work with Jenkins JUnit publisher
% The MIT License (MIT) https://github.com/markuman/mUnittest
if ischar(script)
@ -191,4 +191,4 @@ function ret = globeString(in)
clear xml
end
end
end

Loading…
Cancel
Save