bittersweetryan/ColdFusion-Koans — Issue #23: adding message to mxunit functions
Author: mhenke
Created: 2012-02-11 20:52:18+00:00
State: open

i wanted to get your opinion on moving the comment messages to a variable then adding the variable to the mxunit function. Now the message will appear in the index page on failure.

example for aboutasserts.cfc

/**
* @mxunit:decorators mxunit.framework.decorators.OrderedTestDecorator
*/
component extends="mxunit.framework.TestCase"{

/**
*@order 1
*/
public void function testTrueShouldBeTrue(){

var messsage = "

try replacing false with true

";

assertTrue(false,messsage);
}

/**
*@order 2
*/
public void function testStringsShouldBeEqual(){
var result = "Foo";

var message ="

in the koans __ represents a value that you need to
fill in to make the test return true in

";

assertEquals(result,"__",message);
}

/**
*@order 3
*/
public void function testResultShouldBeEqual(){
var result = 0;

var message = "

and sometimes you'll need to update the code itself to
make the test pass. Here you'll need to change the value
of result to make the test pass

";

assertEquals(result,5,message); //also note that the "" are optional here
}
}