Unit test issue

I just copied the advanced and ran the unit test and i am getting
following error

Variable APPLICATION is undefined.::

if i run the testsuite from the url it works it works but not from
eclipse.

i would really appreciate any help

Eclipse view is totally different and requires a more challengine aproach, there is plenty of documentation on this on the mxUnit website.

If you would like to give us a better understanding on how you have your project setup, and how you have configured mxUnit for the project and global settings we might be able to help further.

But I suggest reading the docs on the mxUnit website before going any further, on how to setup in Eclipse. Then let us know how you went, and we will be able to help you further.

Hi Andrew,

I have pretty simple test setup.

i am running CF9 on Tomcat7 from my root directory

/CFIDE
/app(advanced Template)
/mxunit

i am running Eclipse with CFB plugin and mxunit plugin

I right clicked on GeneralTest.cfc and Ran MxUnit test. thats all i
did.

Thank you for you help. i will also look more into mxunit doc

i missed the coldbox path.

it is also in the root

/coldbox
/CFIDE
/app(advanced Template)
/mxunit

When I mean setup I also mean setting up mxUnit remoteFacade as well, so in your example is the mxUnit in the root of the application? If not then there are certain things you need to do in Eclipse and your App to run the tests.

Also you will need to read the ColdBox docs when it comes to unit testing handlers and such to work correctly with the remoteFacade as well.

Hi Andrew,

it worked after i copied the mxunit inside the /app folder

so now i have it like

/App/mxunit

and i modified the RemoteFacade url to http://localhost:8080/app/mxunit/framework/RemoteFacade.cfc?wsdl

but one thing not working in Eclipse is that the "testSomething" case
but if comment the "setNextEvent('general.index');" from the handler
it works otherwise i am getting
"coldfusion.xml.rpc.CFCInvocationException:
[coldfusion.runtime.AbortException : null]" but the testSuite is
working.

Cool, when you have the mxunit outside of the root, which is the way that I prefer to do it. You also need to make sure that you have a virtual directory set up as well in the web server.

As for your error, you will need to read the docs on how to unit test your handler. As there are certain things you need to do. But the best option is the way I do it, until proven otherwise.

I create my mxunit, coldbox and unit tests directory outside of the webroot. Then I create a VirDir for mxunit, and UnitTests in the web server and a per Application mapping for ColdBox in my Application.cfc

Then inside my unit test directory I place a copy of the remotefacade.cfc and an Application.cfc ( this is explained in the CB wiki as well) the reason for the Application.cfc is to then mimic your application settings to a bare minimum.

Then when you follow the directions in the CB wiki to run and test a handler you should be all ok, provided that you have set the remote facade to the one in the unit tests directory.

i totally forgot about the resources folder under test

if i point the Facade URL to http://localhost:8080/app/test/resources/RemoteFacade.cfc?wsdl"

everything works

Thanks for your help

Have a think about the other way I described how I do it, the beauty about the way I do it, is that it makes it easier to deploy just the application and not the tests.

Do have a think about it.