ken.sykora
unread,Apr 23, 2008, 10:38:01 AM4/23/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mxunit
Hi Everyone -
I've started using mxunit in my projects, and so far I am in love.
I've run into one strange issue though. I'm writing tests to test
concurrency issues, and using <cfthread> to achieve this, but I
noticed that whenever you create a unit test with a call to <Cfthread>
in it, the thread shows up as a function in the unit test. The "fake"
tests created by the threads actually run, but they fail if you make a
reference to the attributes scope.
This isn't a huge deal, because I can just not run those weird tests
that are created but it could be problematic with ANT integration.
Example:
<cfcomponent output="false" extends="mxunit.framework.TestCase">
<cffunction name="thread_10Factorial">
<cfset var i = "">
<cfset results = structnew()>
<cfset assertTrue(true,"sanity check failed")>
<cfloop from="1" to="10" index="i">
<cfthread action="run" name="#i#" threadID="#i#">
<cfset thread.result = 1>
<cfloop from="1" to="10" index="thread.j">
<cfset thread.result = thread.result * thread.j>
</cfloop>
<cfset results[attributes.threadID] = thread.result>
</cfthread>
</cfloop>
<cfloop from="1" to="10" index="i">
<cfthread action="join" name="#i#"/>
<cfset assertEquals(results[i],3628800,"Did not compute 10!")>
</cfloop>
</cffunction>
</cfcomponent>