Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")
a) A vital annoyance to test what I need
b) COMPLICATED!!
I'd like to simplify, and make the tests more readable to "Average Joe" by allowing something like XML or a native multi-dimensional array to generate those regex, but that's complicated in itself so I'd then need to add a handful of methods which tests the helper functions of my test case before I ever use the helper functions. Does this seem reasonable or am I just adding to the risk of over-complicating things?
I haven't even begun to pull hairs out thinking about actually creating those regex in a flexible fashion
I think that even though it is a lot, it is the "simplest" way to test. You are providing test data, and asking for test results.
If you start to build dynamics into your tests, you'll need to test your object/function which creates the dynamic content. Kind of like the dependency tree which you break with mock's, only this time you break with static data.
Are the regex's going to change in the future? If not, there's little point messing with them since they are specific to a test case. Now, that method name on the other hand...
Maugrim_The_Reaper wrote:I think the rock is better than the hard place .
Are the regex's going to change in the future? If not, there's little point messing with them since they are specific to a test case. Now, that method name on the other hand...
Can you not split that test up? I realise you are testing a whole email (thus one test) with 'x', 'y' and 'z' but would it be better to test 'x', 'y' and 'z' seperately? A group maybe?
class A_Multipart_Mixed_And_Alternative_Email extends Test_Case
{
public function test_Detaching_All_Alternative_Parts_Yields_No_Multipart_Alternative_Part_In_Body()
{
}
}
And actually that test would be changing context in the middle of the test, so even better would be:
class A_Multipart_Mixed_And_Alternative_Email_With_All_Alternative_Parts_Detatched extends Test_Case
{
public function test_Has_No_Multipart_Alternative_Part_In_Body()
{
}
}
True I've never tried it, but I assume simpletest can run Group tests inside group tests.
I'm actually going to go through my tests this weekend and refactor/tidy up a bit, possibly even add descriptive comments to the files for some if the scarier tests.