Munit is a test framework for Mumps Unit testing.
It is in a patch that has not been released.
   
Here is a sample of what a unit test routine would look like.
 
XXXX    ;jli/fo-oak - demo code for a unit test routine ;9/25/03  15:44
        ;;
        ; makes it easy to run tests simply by running this routine
        D EN^XTMUNIT("XXXX")
        Q
        ;
SETUP   ; optional entry point
        ; if present executed before any other entry point any variables
        ; or other work that needs to be done for any or all tests in the
        ; routine
        Q
        ;
TEARDOWN        ; optional entry point
        ; if present executed after all other entry points code to remove
        ; any variables, or undo work done in SETUP
        Q
        ;
ENTRY1  ; Example fo use of CHKEQ call to check two values
        ;
        ; code to generate a test, e.g. to check the sum of 1 and 1
        S X=1,Y=1
        D CHKEQ^XTMUNIT(2,X+Y,"1+1 didn't yield 2") ;
        ;
        ; usage of CHKEQ^XTMUNIT
        ;   first argument is the expected value
        ;   second argument is the actual value
        ;   third argument is text to be displayed if the first argument
        ;     and second argument are not equal.
        ;
        ;   Multiple calls to CHKTF^XTMUNIT may be made within one entry
        ;   point.  Each of these is counted as a test.
        ;
        ;   Output for a failure shows the expected and actual values
        Q
        ;
ENTRY2  ; Use of CHKTF call to check value for True or False
        ;
        S ERRMSG="Current user is not an active user on this system"
        D CHKTF^XTMUNIT($$ACTIVE^XUSER(DUZ)>0,ERRMSG)
        ;
        ; usage of CHKTF^XTMUNIT 
        ;    first argument is an expression evaluating to true or false 
value,
        ;    second argument is text to be displayed if the first argument
        ;      evaluates to false.
        ;
        ;    Multiple calls to CHKTF^XTMUNIT may be made within one entry 
        ;    point.  Each of these is counted as a test.
        Q
        ;
ENTRY3  ; Use of CHKTF call to check values that should NOT be equal
        ;
        ; if you want to test something that should fail, use a NOT
        S X=1,Y=3
        D CHKTF^XTMUNIT(X'=Y,"indicated 1 and 3 are equal")
        Q
        ;
ENTRY4  ; Use of the FAIL call to generate a failure message
        ;
        S X=1+2 I X'=3 D FAIL^XTMUNIT("System is doing bad addition 
on 1+2") Q
        ; 
        ; usage of FAIL^XTMUNIT
        ;    the argument is text indicating why the failure was identified
        Q
        ;
        ; Other routine names to be included in testing are listed one 
per line
        ; with the name as the third semi-colon piece on the line and an
        ; optional description of what the routine tests as the fourth 
semi-
        ; colon piece, if desired this permits a suite of test routines 
to be
        ; run by simply starting one of the routine the names may be 
repeated
        ; in multiple routines, but will only be included once. The 
first line
        ; without a third piece terminates the search for routine names 
(which
        ; is why this is above the XTROU tag).
XTROU   ;
        ;;XXXY;description of what the routine tests
        ;;XXXZ;
        ;;XXXA
        ;
        ; Entry points for tests are specified as the third semi-colon 
piece,
        ; a description of what it tests is optional as the fourth semi-co
lon
        ; piece on a line. The first line without a third piece terminates
 the
        ; search for TAGs to be used as entry points
XTENT   ;
        ;;ENTRY1;tests addition of 1 and 1
        ;;ENTRY2;checks active user status
        ;;ENTRY3;
        ;;ENTRY4;example of FAIL^XTMUNIT call
        Q
 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to