Testing MXUnit

compared with
Current by Marc Esher
on Feb 12, 2010 15:49.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (11)

View page history
h3. Setting your "paths"
* In mxunit/buildprops, copy the contents of the antrunner_sample.properties file. Create a new file in that directory named "antrunner.properties"
Fill in your server, port, and webroot properties. For example, mine looks like this:
* Fill in your server, port, and webroot properties and save the file. For example, mine looks like this:
{code:title=antrunner.properties}
server=localhost
webroot=c:/inetpub/wwwroot/
{code}
Save that file

 
h3. Running the tests
* From within Eclipse, drag mxunit/build.xml into the Ant view
*Run the "runTests" target
It'll print out the results in the console view
*It'll print out the results in the console view. A run should look something like this:
 
{code:title=ANT output from runTests}
Buildfile: C:\inetpub\wwwroot\mxunit\build.xml
init:
runTests:
[delete] Deleting directory C:\inetpub\wwwroot\mxunit\tests\testresults\html
[delete] Deleting directory C:\inetpub\wwwroot\mxunit\tests\testresults\tmp
[mkdir] Created dir: C:\inetpub\wwwroot\mxunit\tests\testresults\html
[mkdir] Created dir: C:\inetpub\wwwroot\mxunit\tests\testresults\tmp
[mxunittask] Greetings, earth being ...
[mxunittask] Running MXUnitAntTask version : 1.0.3
[mxunittask] Outputting results to: tests/testresults/tmp
[mxunittask] Verbose: true
[mxunittask] MXunit home :mxunit
[mxunittask] Using server:port : localhost:80
[mxunittask] Using connectionMethod: http
[mxunittask] AuthMethod: no_auth
[mxunittask] Default runner : /mxunit/runner/HttpAntRunner.cfc
[mxunittask] [HttpHelper] Running URL : http://localhost:80/mxunit/runner/HttpAntRunner.cfc?method=run&type=dir&value=c:/inetpub/wwwroot//mxunit/tests/framework/&recurse=false&excludes=&packageName=mxunit.tests.framework&componentPath=mxunit.tests.framework
[mxunittask] [HttpStatus] 200
[mxunittask] [Testresults] Test runs=221. Errors=0. Failures=0. Time=23748ms
[mxunittask] writing file : tests/testresults/tmp/mxunitdirectorytestsuite_1.xml
[mxunittask] [HttpHelper] Running URL : http://localhost:80/mxunit/runner/HttpAntRunner.cfc?method=run&type=dir&value=c:/inetpub/wwwroot//mxunit/tests/runner&recurse=false&excludes=&packageName=mxunit.tests.runner&componentPath=mxunit.tests.runner
[mxunittask] [HttpStatus] 200
[mxunittask] [Testresults] Test runs=20. Errors=0. Failures=0. Time=5785ms
[mxunittask] writing file : tests/testresults/tmp/mxunitdirectorytestsuite_2.xml
[mxunittask] Total testruns: 241
[mxunittask] Total errors: 0
[mxunittask] Total failures: 0
[mxunittask] Total time: 29533
[mxunittask] Failure ratio: .00
[mxunittask] Error ratio: .00
[mxunittask] Success ratio: 1.00
[mxunittask] Fare thee well, human.
[junitreport] Processing C:\inetpub\wwwroot\mxunit\tests\testresults\html\TESTS-TestSuites.xml to C:\Users\marc\AppData\Local\Temp\null2085236895
[junitreport] Loading stylesheet C:\inetpub\wwwroot\mxunit\ant\xsl\junit-frames.xsl
[junitreport] Transform time: 836ms
[junitreport] Deleting: C:\Users\marc\AppData\Local\Temp\null2085236895
BUILD SUCCESSFUL
Total time: 33 seconds
 
{code}

h3. Viewing the JUnit Report

The runTests target will create JUnit XML and run it through the JUnitReport task. This creates an HTML view of the test results. They are placed in mxunit/tests/testresults/html

You can view them in the browser by going to http://<yourserver>:port/mxunit/tests/testresults/html/index.html. It'll look something like this:

!Capture.PNG|thumbnail!


{tip}When you run the tests via run.cfm or via ANT, the "fixtures" and "samples" tests are all filtered out, so you needn't mentally filter them yourself{tip}