Jan 7, 2010

My Rantings on Flex (Part 2)

I am responsible for setting up the Unit test framework for my project and had setup this beautiful FlexUnit TestHarness and TestSuite which sent the results on the jazzy and colorful TestRunner. Things were working fine with the dummy test cases I had added and I was happy. So far so good. Today, the developers started contributing their tests into the test case. All that they did was this

package SomePackage
{
public class Constructor() extends TestCase
{
public function Constructor(){
}

public function getNameAndDate():void
{
var obj:Object=null;
Assert.assertNotNull(obj);
}
}
}
And then add this to the TestSuite.addTestCase(MyTestCase)
and run the test runner.

The testRunner showed a weird test case called "WarningTestCase" and showed some empty results in it. At first look, I asked my dev if he had created a testCase called WarningTestCase (I am a novice to FlexUnit hence this query) and he said he did not. Just to make sure (not that I do not trust my developers...they are the best in the industry), I searched for any instance of WarningTestCase and did not find any. Now I was flabbergasted. There should be some information on this somewhere in the net. So I Googled for WarningTestCase FlexUnit and got some half baked information from Adobe that WarningTestCase means that some of the tests within one of my testCases has failed. (This was the worst kind of error message I have ever seen in my Goddamn career as a software engineer). I am sure Adobe has some brilliant minds who could atleast make well described well defined error messages.

OK. So I went to try to find which is the test case that's failing. I tried all the available test cases and they all worked fine but this one test case was failing. I was almost on the verge of giving up when I tried one last step. I prefixed all the functions with the term test. So now getNameAndDate would go by testgetNameAndDate. I ran this test case. And Voila, the test runner showed me all the test results with appropriate assert status.

The least I would have expected would have been well defined error return codes and something that would have been documented for dummies like myself to understand.


No comments: