Friday, February 5. 2010FlexUnit's Test Theories: Don't BotherComments
Display comments as
(Linear | Threaded)
What you're looking for are Parameterized tests (see the Parameterized class in junit). FlexUnit will eventually support this idea of creating multiple tests from a single function given a set of test data. Theories are meant to correspond to scientific or mathematical theories - if there's a single data point that shows the theory to be false, the entire theory is invalid (hence the single test). I agree that the error reporting is useless. That needs to be fixed. Thanks for the comment, Alan. If their intention is to mimic "proving a scientific theory", then yes - the "only yielding one test" behavior does make sense. And, since I've got you here… Has Adobe (or anyone else you know of?) found this style of testing useful? Grepping through the FlexUnit source, I was only able to find one test suite ( I'd thought that one colleague had found a use for them, but that turns out not to be the case. So I have to say that I'm not personally aware of anyone who's used Theories for actual testing. We use them extesnively.. that could be why we wrote them too. As Alan correctly suggested the word theory implies scientific theories. The parameterized testing we were working on is more along the lines of what you did here and what you are looking for. Where theories are really useful is for reversible conditions over a potentially infinite number of test cases. So, for example, we have an application that must support gregorian and hijri date systems. So, we have thousands of dates that we convert from hijri to gregorian and then back to gregorian to ensure they match. Theories are one type of test intended to help with triangulation. They are not a solution by themselves, only when applied with standard tests that confirm functionality at known points. Regarding lack of documentation. We are a completely community driven open-source project. We are not funded in any way and everything that exists is purely community effort, so we would be happy to have people who are willing to write help document these thigns. HTH, Mike |
QuicksearchArchivesLinksCategories |
A couple of days ago, I complained about FlexUnit's Theories. Well, with a bit of encouragement from @drewbourne, I broke down and wrote a proper parameterized testrunner: [RunWith("utils.testrunners.ParameterizedRunner")] class AdditionTests {
Tracked: Feb 10, 11:03