Skip to content

Compiling and running tests

mikestead edited this page Dec 23, 2010 · 12 revisions

Test Command

The test command is the main command used when developing with unit tests to updates, compiles and runs all targets within a hxml build file

haxelib run munit test

What it does

  1. Updates active test cases using the gen command
  2. Compiles the targets within the hxml build file
  3. Runs all compiled targets using the run command

By default this command uses the settings from the .munit settings in the project so you don't need to specify anything.

Alternatively you can specify a single target within the build file through a -[platform] flag. Valid options are -swf, -swf9, -neko and -js

haxelib run munit test -swf9

To use this command outside a munit project you can also specify manual paths to the hxml, bin, src and report paths you are working with.

Run the inline help for detailed instructions on individual command line options

haxelib run munit help test

Run Command

The run command launches one or more target applications from a specified path

It matches files ending in _test.swf, _test.js and _test.n

haxelib run munit run

By default this command uses the settings defined in the .munit settings in the project so you don't need to specify anything.

How it works

The run command works by launching a nekoserver via localhost to capture http results from flash, javascript and neko targets.

It also launches flash and javascript test applications via your default browser from a localhost url.

It saves junit style generated reports into the report directory on completion.

Browser Settings

By default munit run uses the default browser to launch swf and js targets

To specify an alternate browser use the -browser flag

haxelib run munit test -browser FireFox;

Known Issues

Running swf and js tests in Safari

There is currently a bug which prevents tests being run in the Safari browser for js, swf and swf9 platforms. The bug seems to relate to the nekotools server injecting header information into the body of html and js files.

Running tests under Windows 7 (possibly XP too)

When executing the tests using the command line tool on windows, you can occasionally receive the following fatal error:

Fatal error in gc: Bad stack base in GC_register_my_thread_inner

This appears to be an issue with a third party library NekoVM is using and is unfortunately beyond our control.

Further information: http://haxe.1354130.n2.nabble.com/neko-fatal-error-in-gc-td4272564.html http://haxe.1354130.n2.nabble.com/Bad-stack-base-in-GC-register-my-thread-inner-td5623216.html

.