mxunit - config.xml file does not validate with the framework's schema

I’m new to ColdBox and trying to get MXunit setup…

My environment

  • wwwroot
    – myproject
    – anotherproject
    – mxunit
    – coldbox

I copied the test example directory structure from the 3.0.0 download, and am slowly making my way through this: http://wiki.coldbox.org/wiki/Testing.cfm

When I run the default tests I get:

testindex Element DATABASE.MAIN is undefined in APPLICATION

Which makes sense… I’m guessing I need to reference the application’s application.cfc… I then found some posts mentioning appMapping

And that’s where I’m currently stuck:

Hi Jim,

I am making an intro video on this and will release today.

I suggest using the application templates in 3.0 to start off. You will see the new testing approach and a separate Application.cfc for testing so you can have separation over the real application.

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

I’ve tried using the files from:

coldbox_3.0.0\ApplicationTemplates\Simple\test

Which does have its own Application.cfc. It seems like I need to reference my main application.cfc however to pull in all the settings defined there, and I believe we are using environment stuff as well. Still trying to figure out what / where everything is :slight_smile:

I also found an alternative setup on John Whish’s blog with the same results… so I’m guessing I’m missing something simple (I hope) :slight_smile:

Thanks! I look forward to seeing your video!
Jim

video is done, processing and uploading and will be done soon.

Hope this clarifies some things about testing!

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Still editing it but will place an unedited version for download.

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

For those of you who want it now: http://ortus-public.s3.amazonaws.com/coldbox-integration-testing.mov

I will upload to vimeo soon

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Luis, the video was very helpful!

I’m going through everything again this morning to verify I have everything setup correctly.

Thanks!
Jim

Getting closer…

To confirm I was doing things correctly I setup a new project following the steps you took in the video and that works correctly. So MXunit/Eclipse seem happy.

My environment:

webroot
– coldbox
– currentproject
---- test
– newproject
---- test

So I did exactly the same thing in my current project

  • copied the sample /test directory from ColdBox into my project
  • setup test runner url and cfc path in Eclispe
  • set AppMapping correctly /currentproject
  • verified I could hit wsdl in browser

I grabbed the RemoteFacadeTester.cfm from the MXUnit troubleshooting help and it indicates everything is OK

running test through remote facade
Ping result: YES
Server Type: ColdFusion Server

But running the tests through Eclipse is failing…

When I fire my test it runs and fails… in Eclipse I can see the Tag context and trace where it’s failing…

testindex
Status: ERROR
Result: Element DATABASE.MAIN is undefined in APPLICATION.

I think I’m having issues with paths in my config as noted in the “Testing” docs:

Hi Jim I would have to see what you are doing exactly. As if the app loads itr fires everything like a normal application just headlessly. Where is the setup of application variables?

Luis Majano
President
Ortus Solutions, Corp
Toll free phone/fax: 1-888-557-8057
Mobile: 909-248-3408
www.ortussolutions.com
www.coldbox.org

OK I think I found out what the issue is - just need a suggestion on how to fix it…

My debugging steps…

Tracing through the app (given my limited knowledge of ColdBox) I think it’s doing:

  1. coi\application.cfc sets: application.implementation = “XYZ”

  2. coi\config\coldbox.cfc calls coi.interceptors.configuration

  3. coi.interceptors.configuration extends /common/interceptors/configuration

  4. Within afterConfigurationLoad() in /common/interceptors/configuration.cfc

I see:

Which should be loading the /coi/config/xyz.cfm file which is where my application vars are set.

I dumped things here to verify what was being set and found the issue:

Application: application.directory = /coi

Testing: application.directory = /resources

Ah ha!

So what’s the best way to override that application.directory value at test run time and set it correctly?

Jim

Jim,

To tell you the truth, I have not hit that problem as I don’t specifically use the application scope for anything. It bounds me to problems like this that are hard to mock since they are set explicitly. I would probably consider a environment detection via the ColdBox configuration and rely on settings instead of direct application scope settings. This way you can easily mock them once the engine starts. Again, I am not seeing your code so have no perspective of what you are doing there.

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Thanks Luis! I was worried that would be the case.

I'll put off testing for now until I can get a bit more familiar with
this code and see if it's possible we can refactor things.

I'm guessing the application scoped vars are going to be all over the
place so maybe it's not worth the effort...

Jim

Sorry :frowning:

But the good thing about testing is that sometimes exposes code :slight_smile:

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano