testbox mxunit mxunit:dataProvider

Hey all,
so new to testbox. we are on CF9 so can’t use BDD style, so just working off my basic mxunit tests. I have a lot of tests where I am using the mxunit dataProvider to pass structure data to a model function…this does not work in testbox, so does this mean i have to learn how to use mocking/mockbox to pass in the data that i could pass in with a dataProvider?

if this is correct, where is the best place to see how this is done, via the samples in testbox, or some place else?

thanks
dan

I don’t believe that feature is implemented yet in TestBox. Would you mind putting in a ticket?

http://wiki.mxunit.org/display/default/Data+driven+testing+with+MXUnit+dataproviders

https://ortussolutions.atlassian.net/browse/TESTBOX/

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

You can do this already in the BDD style as you can iterate and call it() functions with any data you can loop over.

As for xunit, I did not implement this as it would require messing a lot more with the runner and in all reality our preference is to have BDD first. Therefore my answer would be it could be implemented if enough votes for it are made. Else, jus use the BDD style.

I can put in a ticket on this and then people can vote, that is fine.
Luis, I can’t use BDD style testing yet because at my job we just upgraded to CF 9.2…i’d like to use BDD style i think it fits much better into the way our crazy system is set up, but can’t yet.

is there a way to use mocking/stubbing to figure this out?

thanks guys
Dan

One of the problems I have with writing loops in your unit tests is when one of 15 iterations fails, you don’t know which piece of data it failed on. Now, for some reason, I was thinking that MXunit automatically added the data being looped on in the failure message so you would know, but apparently I dreamed that up after checking the docs and actually trying it.

I would like to see the data provider pattern in TestBox and I think we should find a way where the failure message automatically communicates which iteration of the data failed.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

You could just add an assert failure message to the assert inside your loop - but it would be nice if it was done automatically for you :slight_smile: