gmUnit is an xUnit style unit testing and profiling suite for GameMaker. Unit testing allows you to automatically test your scripts by providing known inputs and expected outputs, revealing instantly and exactly where a fault has occurred after you modify your code. It is extremely quick and easy to use.

Download gmUnit v1.0



Features

  • Automatic testing
    All of your tests can be run at once.
  • Report generation
    After testing a detailed report file is generated.
  • Profiling
    Every test is timed using a high resolution timer, allowing you to log performance improvements.

Usage Examples (GML)

assert ( 1 , '==' , 1 ) ;
assert ( 'point_distance(0,0,1,1)' , '==' , 1 ) ;
assert ( '"hello"' , '==' , '"hello"' ) ;
assert ( pi , '==' , - pi ) ;
assert ( 2 , '>' , 1 ) ;
assert ( 2 , '>=' , 5 ) ;
assert ( 'my_func()' , '==' , 1.258728 ) ;
assert ( '4 mod 2' , '==' , 0 ) ;
logpath = run_tests ( my_tests ) ;
/////////////////////////
// gmUnit 1.0.0 by OL  //
/////////////////////////

my_tests  -  10/07/2010 09:57:42 PM

.x.x.x.

Tests performed under the scope of .
Completed 7 assertions in about 20.59 ms.
4 passed (57.14%).
3 failed (42.86%).

(#1)  PASSED  1.66 ms  >>>  1.000000 == 1.000000  >>>  1.000000 == 1.000000
(#2)  FAILED  1.05 ms  >>>  point_distance(0,0,1,1) == 1.000000  >>>  1.414214 == 1.000000
(#3)  PASSED  0.21 ms  >>>  "hello" == "hello"  >>>  "hello" == "hello"
(#4)  FAILED  0.22 ms  >>>  3.141593 == -3.141593  >>>  3.141593 == -3.141593
(#5)  PASSED  0.37 ms  >>>  2.000000 > 1.000000  >>>  2.000000 > 1.000000
(#6)  FAILED  0.22 ms  >>>  2.000000 >= 5.000000  >>>  2.000000 >= 5.000000
(#7)  PASSED  16.86 ms  >>>  my_func() == 1.258728  >>>  1.258728 == 1.258728

DONE.

Download gmUnit v1.0