MXUNIT Testing and Security Plugin

I have enabled the builtin security plugin and have locked down a
couple of handlers. When I go to test those handlers using the builtin
MXUnit tester, I receive a prompt to login to the Coldfusion Server
admin. If I launch the app and run those events that are locked down
and login manually, I can then run the unit tests and they work fine.
I have tried calling my login events in my test cases, which do login,
but I still get the Coldfusion Server Admin Screen login.

Anybody have any ideas of how to get this to work?

Thanks,
Shane

HI Shane,

This is a perfect test case for creating a separate coldbox.xml for unit testing purposes. This way, you do NOT declare the security interceptor, because you are doing unit testing.

My recommendation is to create a separate unit testing coldbox.xml file.

Luis

Hi Luis,
I setup multiple coldbox.xml files, but still get the same error. What
appears to be happening is the Application.cfc is loading my standard
coldbox.xml file, my unit test setup loads my altered coldbox.xml file
but it doesn't seem to overwrite the security settings. What it looks
like I have to do is put some logic in the Application.cfc to change
the coldbox.xml file depending on the requesting url. I don't know if
that is possible, I am new to coldfusion and coldbox.

-Shane

All right, I think I have this working now. I set the
persist_framework = false; I set <Setting
name="ConfigAutoReload" value="true" /> in both my
coldbox.xml files. And I didn't have to make any changes to the
application.cfc. Since I am using transfer, I had to fully qualify the
paths from webroot in my base coldbox.xml file.

  <YourSettings>
    <Setting name="TransferSettings.datasourcePath" value="/
coldboxOrderAdmin/config/datasource.xml.cfm" />
    <Setting name="TransferSettings.configPath" value="/
coldboxOrderAdmin/config/transfer.xml.cfm" />
    <Setting name="TransferSettings.definitionPath" value="/
coldboxOrderAdmin/config/definitions/" />

    <Setting name="ColdBoxSideBar" value="true" />
  </YourSettings>

Thanks,
Shane