application variables are not found when running MXUnit test from Eclipse
Asked Answered
O

2

5

So I was following the tiny guide here on how to run a single MXUnit test with Eclipse using the MXUnit plugin for Eclipse. But as you can see in the screen shot below it didn't work out for tests that I know work, because it appears that the application variables are not available using this method. Is that something that will not work? or is there something that I can do to make that application and it's variables accessible when running tests this way?

Error when running a single test

Oubre answered 8/12, 2010 at 1:59 Comment(1)
Erik, I have updated the wiki page you linked to include the answer I gave below.Cheree
C
7

Erik, you need to point to a custom RemoteFacade.cfc which you'll create and put in the directory where your tests live. This is fully described in the plugin's help, which you can access by clicking the green question mark icon in the MXUnit view.

Click that icon, and then click the "Talking to ColdFusion: The RemoteFacade.cfc URL".

Interestingly enough, your question is asked almost verbatim on the mxunit wiki: http://wiki.mxunit.org/display/default/Eclipse+Plugin+FAQ#EclipsePluginFAQ-Q%3AWhenIrunthetestsintheplugin%2CmyApplicationscopevariablesaren%27tpresent

Definitely check the wiki, and in particular the FAQ page, when problems like this arise. Usually the FAQs will point you to the correct documentation which will help you solve these problems.

Cheree answered 8/12, 2010 at 13:40 Comment(4)
Thanks Marc! Is this documentation online anywhere btw?Oubre
Thanks Marc for pointing me to the correct solution, I'll try that!Vulvitis
Erik, I try to keep the nitty-gritty "here's how to configure and use the plugin" documentation in the plugin itself. Our wiki contains lots of other stuff, but with respect to plugin usage it's usually just "click the green question mark".Cheree
It'd be easier to find and read if the information were online imo.Oubre
K
2

I don't have an "answer" for you, but as I'm struggling with something similar, I do have some advice to help clarify your situation.

In your MXUnit test, use the debug() method to save a dump of the application scope in its current state during the test. After running the test, select the error/failed test in the left pane and hit the B key to show the debug output from the test. Then you will know for sure whether the variables are there or not.

In my case, this shows that my tests are not running in the application context that I'm expecting (application name is from the web-root Application.cfc, not the sub-folder that my tests live in), so I need to figure out why that is. Hope that helps some!

Klystron answered 8/12, 2010 at 2:46 Comment(2)
wow - that keyboard shortcut to open the debug output is something I'd been hunting for for a long time. Thanks for sharing! Is it mentioned anywhere in the mxunit or CFBuilder docs?Zoomorphism
@Zoomorphism sorry, it's been many many years since I last used CFB/Eclipse. I couldn't tell you where I picked it up. I didn't even remember it. Reading this answer was like learning it again for the first time for me. ;)Klystron

© 2022 - 2024 — McMap. All rights reserved.