MXUNIT and Coldfusion 2021?

171 views
Skip to first unread message

Tim Fitzpatrick

unread,
Feb 25, 2021, 7:39:42 AM2/25/21
to mxunit
Wow this group looks pretty dead, but worth a shot to ask here... looking at upgrading from CF2016 to 2021, and my mxunit tests are failing across the board with the message
Variable VARIABLES is undefined in static context.
It must be a static or local/var scoped variable.

The stack trace points to mxunit's framework:

C:\_Sites\Codebases\Mainline\mxunit\framework\TestSuite.cfc (108)
C:\_Sites\Codebases\Mainline\mxunit\runner\DirectoryTestSuite.cfc (29)

Has anyone gotten this working with 2021? Obviously it needs some changes. I can dig through it... but it would be good to know if this was already resolved.


Max Haventon

unread,
Apr 22, 2021, 4:34:49 PM4/22/21
to mxunit
Hi Tim,

Yeah, MXUnit is very dead it seems. Just like you I ran into this issue when testing out CF2021. I managed to solve it by removing the static="true" attribute from all functions in /framework/Assert.cfc and by removing the HamcrestAssert.cfc and XPathAssert.cfc-references from mxunit-config.xml.

Hope it helps!

Kai Koenig

unread,
Apr 22, 2021, 5:34:31 PM4/22/21
to mxu...@googlegroups.com
You should be able to migrate from MXUnit to Testbox unit tests in a *reasonably* straight forward way. That might be the better mid-term option than monkey-patching a dead library.

Kai

Tim Fitzpatrick

unread,
Apr 23, 2021, 9:59:44 AM4/23/21
to mxunit
Thanks, that is what I ended up doing. Adobe actually provided that answer. I'm still going through edits for about 20 tests that fail, which is much better than 3500+. Surprisingly some of them seem like they shouldn't have passed before... CF2021 is stricter.

Tim Fitzpatrick

unread,
Apr 23, 2021, 9:59:44 AM4/23/21
to mxunit
I did look at that, and I'm sure we'll move that way, but I needed a quicker way to get 3500+ tests working. So far it's not too painful. We plan to migrate to TestBox.

Tim

unread,
Dec 15, 2022, 2:30:28 PM12/15/22
to mxunit
Just happened across this. Thank you for saving my sanity. Removing the static="true" from all the places did what I needed.

Bill Tudor

unread,
Apr 6, 2023, 6:18:32 AM4/6/23
to mxunit
Just wanted to say thanks for posting this - it worked for my experiment with CF2021+mxunit. I'm guessing as a general rule static attribute is best avoided with CF2021 (tbh it's not an attribute we seem to have made much use of in the legacy codebase)
Reply all
Reply to author
Forward
0 new messages