Overwriting Testcase's special methodsat 2011-03-21 in Unittests, Announcements by friebe (0 comments) A fix has been committed to the unittest API that prevents (accidentally) overwriting special methods from unittest.TestCase. What had happened is the following:class SystemPropertyTest extends TestCase { As the XP Framework doesn't require a "test" prefix on the method names, it has become common practice to name the test methods after the methods they're testing, usually appending or prepending the variant (e.g. "singleAddItem" and "multipleAddItem"); in this case there was no variation and thus the simple name. Unintentionally, this was now overwriting the unittest.TestCase::getName() method, which in turn was creating faulty output when rendering the test result. If you made the above testcase fail, the test runner would even raise an uncaught exception and not report any results at all. This has now been fixed; and the erroneous overwriting will be reported early along as lang.IllegalStateException: Cannot override unittest.TestCase::getName with test method in com.example.unittest.systems.SystemPropertyTest. |
|