Yeah, A couple of us were quite sure what I had should work and were surprised when it didn't.
Your example looks like a winner to get the test working like it needs to though! .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com -----Original Message----- From: Dominic Watson [mailto:[email protected]] Sent: Saturday, October 08, 2011 10:54 AM To: cf-talk Subject: Re: MXUnit - Fail a success While I'm not sure why the test is not failing, I've done this before with: var failed = false; try { doSomething(); } catch( someError e ) { failed = true; } Assert(failed); Your method is more elegant I think, would be interesting to see why it isn't working. Dominic On 8 October 2011 00:27, Bobby Hartsfield <[email protected]> wrote: > > Thanks Matt. I did see that list but figured people here were likely users > of MXUnit and gave it a shot. > > I'll resort to the google group if all else fails. > > Thanks again. > > .:.:.:.:.:.:.:.:.:.:.:.:. > Bobby Hartsfield > http://acoderslife.com > http://cf4em.com > > > > > -----Original Message----- > From: Matt Quackenbush [mailto:[email protected]] > Sent: Friday, October 07, 2011 3:20 PM > To: cf-talk > Subject: Re: MXUnit - Fail a success > > > I'm not certain the answer to your question, but wanted to make sure you > know about the MXUnit list. I suspect you might have better luck getting an > answer over there. > > http://groups.google.com/group/mxunit > > (I would have also expected the test to fail, based upon what you've > posted.) > > > On Fri, Oct 7, 2011 at 2:13 PM, Bobby Hartsfield > <[email protected]>wrote: > >> >> Sounds like an odd request right? lol >> >> So I have a method that I have written some unit tests for. What I want to >> add is a test that tests missing arguments. There are two arguments in my >> method and both are required so I wanted a test for passing no arguments. >> >> This is what I tried: >> >> >> >> try >> >> { >> >> local.result = >> instance.myService.meyMethod(); >> >> fail(); >> >> } >> >> catch(Application e) { } >> >> >> >> >> >> The above test passed. I THOUGHT the fail() was going to ensure that if >> anyone came along and made the arguments not required that the test would >> fail but the catch appears to be catching that as well... >> >> For instance, I tried this. >> >> >> >> >> >> try >> >> { >> >> local.result = 1; >> >> fail(); >> >> } >> >> catch(Application e) { } >> >> >> >> >> >> That test still passes... >> >> >> >> What I also thought was odd was that the exception type thrown by calling >> my >> method with no arguments was not the missingArgument type, it was >> application. I'm assuming that application type is simply catching > whatever >> fail () is doing as well as my missing argument error and there for > hitting >> the catch. >> >> >> >> Does anyone know a solution to make this work as expected? >> >> >> >> I am on CF 8.0.1 by the way and running mxUnit 2.0.3 >> >> >> >> Thanks. >> >> >> >> >> >> .:.:.:.:.:.:.:.:.:.:.:.:. >> >> Bobby Hartsfield >> >> http://acoderslife.com >> >> http://cf4em.com >> >> >> >> >> >> >> >> >> >> >> >> >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348023 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

