-
Notifications
You must be signed in to change notification settings - Fork 56
Home
Welcome to the MassiveUnit wiki!
Prerequisites: You'll need to have Haxe installed with Neko.
For instructions for targeting Haxe 3 RC - please refer to https://github.com/massiveinteractive/MassiveUnit/wiki/Migrating-to-Haxe-3
Run the following commands to install munit, configure it for a project and then run some example tests for all supported platforms.
> haxelib install munit
> mkdir ExampleProject
> cd ExampleProject
> haxelib run munit config
> haxelib run munit test
And if you'd like to test say, just the JavaScript and ActionScript 3.0 targets
> haxelib run munit test -js -as3
A useful tip is to add a shortcut for munit to you terminal or cmd prompt to save you typing haxelib run munit ..
each time. On OSX add an alias:
alias munit="haxelib run munit"
On Windows create a munit.bat
file with the following contents
haxelib run munit %*
and make sure the folder which contains it is under your PATH environment variable. On Windows you can typically place the .bat file in the same folder as haxe.exe
.
munit uses haXe metadata to execute test cases at runtime. To create a new test case, simply create an empty class and use the following metadata syntax:
@Test
public function testExample():Void
{
Assert.isTrue(true);
}
For detailed information on TestCase metadata see Working with test classes
The munit build tool makes working with unit tests easier and quicker.
To check that the tool is installed
haxelib run munit
This should display summary help information for all the commands. We recommend using the inbuilt help for detailed usage and instructions
haxelib run munit help <command>
More information
- Setting up a new munit project
- Generating Test Classes
- Compiling and running tests
- Integrating with MCover Code Coverage
For general usage developers should use releases installed via haxelib.
A core goal of MUnit is to provide a cross platform unit testing framework across all HaXe targets, but at this point it officially supports only JavaScript, Flash (as2/as3) and Neko targets.
Hopefully over time we can increase this set to include other common targets such as cpp, php and node.js. We welcome contributors for these additional targets.
To get started, below are several resources for where to start...
There are a number of known platform specific issues that may prevent tests from running correctly.
See Known Issues for more details on:
- Running swf and js tests in Safari
-
Fatal Error in gc
under Windows 7 (possibly XP too) - HTTP POST causes Nekotools server to hang with JUnit reports (fixed in 2.1.2)
-
haxelib run munit test
doesn't return correct error code on OSX