[Testbox v1.0.0] makePublic

Hi,

Just looking at Testbox with a view to moving to BDD. I’ve got the MXUnit adapter inplace so can use assertTrue / assertFalse etc, but reading through the docs and code I can see a makePublic method, but not a injectProperty or injectMethod methods - are these available?

In case it’s useful here’s some small issues / gotchas I’ve found:

Looking forward to moving into BDD - thanks for your efforts on this :slight_smile:

Regards,

John

HI John,

Thanks for trying it out. We are still kicking out the kinks for release next week of 1.0

Here are your answers:

injectProperty and injectMethod where actually contributed from us to MXUnit since they came from MockBox. They exist in MockBox however, I guess I will add them to the compat TestCase. If not, we would suggest using MOckBox instead as they basically do what MockBox does.

Yes, the assets run from /testbox mapping, so that must be avaiable. Suggestions?

The run all button must have a bug on it. I will revise it.

On prefix and suffix for “test” it only does prefix, but I will add suffix as well. Granted, this is only for xUnit testing.

John,

I have committed all fixes to the repo for you to try out. These should be all in for final release next week.

signature0.jpg

Luis F. Majano
CEO
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

Hi Luis,

Thanks for the additions - just checked it out and working nicely :slight_smile:

In terms of the paths to CSS and jQuery files, as the tests are run locally then you could just put the jQuery and CSS inline in the HTML output. It’s not as clean but as bandwidth isn’t an issue it will make it more portable. Alternatively you could use the CDN for jQuery with a fallback to the local version if working offline. Something like:

The CSS would still need to be inline though.

Had a quick look at the BDD stuff and that’s really nice - good work!

Thanks,

John

Thanks for that John,

I have added inline styles and js instead. This should be useful as people don’t want to expose framework stuff. So it works great now.

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

signature0.jpg

Luis F. Majano
CEO
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

MockBox is great - some nice features. TestBox is also really good and nice being able to write tests in a BDD style. The only things I’m missing compared to MXUnit is the transaction decorator and dataproviders but I can replicate these without too much trouble.

I noticed that you have assertEqual / isEqual etc which are in the format isEqual(actual, expected) which is switched compared to jUnit and MXUnit which is expected, actual. The MXUnit documentation is a bit muddled on this, but that’s how it is in the code. https://github.com/mxunit/mxunit/blob/master/framework/Assert.cfc#L231 [Assert (JUnit API)(double, double)](Assert (JUnit API)(double, double)) Is there a reason for that? It’s not really an issue, just curious why you switched it.

Cheers,

John

Hi John. Thanks for the feedback.

Decorators.
We have this in the roadmap but in the near future. Not for our 1.0 release. However. In bdd this becomes easier since you can use closures.

Assert equal.
To tell you the truth I thought it was like that I guess I missed it. It will switch it back around as it should be expected and then actual.

You sir have hawk eyes.

Hi Luis,

Getting into my stride now with MockBox and TestBox! The prepareMock method is awesome for decorating the CUT :slight_smile:

Using BDD is very different to TDD and I’m still not quite confident with how I’m using it but that’s a whole new subject!!

One thing that did trip me up is how to use the $args method to mock behaviour using argument matching as only a simple example with 1 positional argument is shown on the wiki. It might be worth adding named arguments:

CUT.$(‘hasStock’).$args(sku=‘ABC’,quantity=10).$results(true);
CUT.$(‘hasStock’).$args(sku=‘XYZ’,quantity=10).$results(false);

and multiple positional arguments

CUT.$(‘hasStock’).$args(‘ABC’,10).$results(true);
CUT.$(‘hasStock’).$args(‘XYZ’,10).$results(false);

Thanks,

John

Hi John,

Technically, there should not be any difference between them, only if you use preserveArgumentTypes, then you need to do it exactly as it is in code with default arguments as wel.

Luis F. Majano
CEO
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