woothemes/woocommerce — pull request #6993 by JeroenSormani (2014-12-21 21:23:34+00:00)
Title: Use @dataProvider to test multiple values

Hey,

This is a proposal and not - yet - a full pull request. I've changed one test to have a dataProvider to discuss using this.

@barrykooij answered my question at WordSesh about using multiple asserts and he mentioned to *try* to use one assert per test.

Using a dataProvider has some advantages and a little disadvantage IMO.
+ Each element is a test by itself
+ Its considered good practice to use one assert per test
+ My biggest reason to use a dataProvider vs. multiple asserts; When a assert fails, the rest of the asserts will not be tested and it will only give feedback on the one fail. In a situation where multiple asserts (would) fail, you would get feedback on the first, fix it -> test it -> and after that you will notice there is another fail and repeat that again and again.

The con I have is that is might be a bit less readable, but its still good.

Old: http://cl.ly/image/1k033528203h
New: http://cl.ly/image/3f2q303a0L36

Love to hear you guys thoughts on it.