MATLAB Examples

Example 01

Minimal xml file generated from a single test case.

% Create test case object.
test_case = junit.TestCase;
% Generate a standard out
test_case.stdout = matlab_ipsum;
% Write the TestCase as an xml file with .m filename.
test_case.xmlwrite(mfilename);

type([mfilename '.xml']);
<?xml version="1.0" encoding="utf-8"?>
<testsuites errors="0" failures="0" skipped="0" tests="1" time="0.00">
   <testsuite errors="0" failures="0" hostname="USGALWHP6047580" id="0" name="TestSuite" package="matlab" skipped="0" tests="1" timestamp="2017-08-11 17:49:49">
      <testcase time="0" timestamp="2017-08-11 17:49:48">
         <system-out>Eoharaoco lslyi oggt oatecsg tsueis waitnsoee aena?  Ltonisopk eob, alnaah nesevinm lzdadol doihir lart otewtrc.  Fie iaehs elthheyy otwahe powlltdc ltaeoioe aeuwu hsrlete.  Ohetolismuti edtoiegeo iurm wntemtra snucnoe ieoot cehrneaet eunaneouo soeoir.  \n\nHsnatl dotate rhteetsi adsnt cueoen cclhwa, odadeos iaudio osuehu gtrhd.  Evyaeede haicd dmihyiao ln aropsloo acsemaehe das tteenem lendsoif, agpotas ishltt aeeehoatin.  Etenn aootfu ahsreawahoo rraht ocwotciure dctdic iesiaeeaiiea wstw tieee.  \n\nEyvrtreb cteuhe gtohene roe eteo nwst oleaa oat.  Oir taiinneme hreihooa tendvniep unnaon hfihid ab.  Ehtbolhyhl oe eefritnie vevmtdcdo lecryetagl tioworaf nhiooe aranaoi hiew eogcn leouwho dnhed.  Esoeeee enuoeruhv eoeooe erugid, bwderot yan einulise eoesgwttaa eonosnnm.  Aaeond igte hranaeo ooe uefssmeo nitssoue rrrt lhovon ieorwriee enicaphnreu ose heyde.</system-out>
      </testcase>
   </testsuite>
</testsuites>