UnittestsOverwriting Testcase's special methodsat 2011-03-21 in Unittests, Announcements by friebeA 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. 5.8.1-RELEASE: Command line, chains, testing and MySQLxat 2011-03-14 in Announcements, Databases, Unittests, Releases by friebeThe XP group would like to announce the immediate availability of XP, version 5.8.1. This release includes a bigger change to the exception mechanism, lang.ChainedException's functionality has been moved to the base class lang.Throwable and all exceptions may now optionally have a cause. This is consistent with Java (since 1.4, java.lang.Throwable has getCause() and corresponding constructors), C#'s InnerException and PHP's "previous" exception (available since 5.3.0). Other bigger changes are now that MySQL connectivity is provided by a userland driver implementation in certain cases - see Heads up: XP Framework and MySQL for further details. Also noteable are the possibility to run a single test method from the command line as well as the command line reflection improvements. For a full list of changes and to download the release, visit: http://releases.xp-framework.net/xml/release?5.8.1 New feature: Run a single testat 2011-03-05 in Unittests by friebeOn a short note: In order to run a single test it is now possible to supply the test name after the class name separated with "::": $ unittest net.xp_framework.unittest.text.StringTokenizerTest::pushBackRegex Happy testing Unittest command now shows time takenat 2010-12-31 in Unittests by friebe The unittest command distributed along with the XP Framework now includes the total time all the unittests it executed in one run have taken:$ unittest -e '$this->assertEquals(1, 1);'Granted, in this case, the execution time is too fast to be displayed in milliseconds - for the XML testsuite, though, the time is "measureable": (more) Matching exception messages with regular expressionat 2010-09-18 in Unittests by friebeThe unittest API has been extended to support regular expression matching on expected exception messages. To make use of this feature, use a forward slash ("/") as the first character in @expect(withMessage). Here's an example: #[@test, @expect(The real message is something like Call to undefined method Proxy?1::doesNotExist() from scope net.xp_framework.unittest.remote.IntegrationTest, but the class name is generated, and the scope may change when the class is moved, so we only want to check on parts of it. This new feature makes this possible. Bind server sockets to any free portat 2010-02-01 in Unittests, Editorial, Announcements by friebeAt the company I work for, we let the XP Framework's unittest run on various different machines, including Windows 2008 server and 32- as well as 64-bit Debian Linux boxes, with PHP versions ranging from 5.2.0 - 5.3.1 (lots of permutation, yes). ![]() On some of the newer machines we have configured Hudson to start multiple test runners at the same time. This lead to problems with the integration tests (for the FTP API, for example) where we actually fork off a standalone server in the background: The port in use was hardcoded. While this is perfectly OK normally, with mutiples suites executing simultaneously and trying to bind the same port, we were running into problems. (more) XP on a Macat 2010-01-24 in Releases, Unittests by friebeContinuing our series of trying to get the XP Framework run on as many platforms as possible, here's our newest achievement: ![]() So far we have:
Continuous integration with Hudsonat 2009-10-02 in Unittests by friebeThe XP Framework's unittest suite has been extended by a new test listener which produces an XML file adequate for continuous integration systems. Test listeners receive events such as when as test run is started, a test succeeds, fails or is skipped and finally when the run is completed. In fact, the dots you see appearing on your console when running tests are implemented with a listener! Here's what the Hudson dashboard looks like: ![]() To make the unittest command produce the XML files necessary to have Hudson render this overview, use the "-l" option: $ unittest -l unittest.XmlTestListener hudson.xml [test [test [...]]] Happy testing RFC #0188: Test outcomeat 2009-09-28 in RFCs, Unittests by friebeScope of Change At the moment, there are three possible outcomes of a unittest: Succeeded, Skipped and Failed. This RFC suggests adding more kinds of outcomes: Error and NotRun. Rationale Be able to distinguish between the different non-success reasons. Read the full RFC here RFC #0187: @expect withMessageat 2009-08-23 in RFCs, Unittests by friebeScope of Change The @expect annotation will be enhanced to provide a means for also checking the expected exception's message. Rationale Ensuring a certain exception message requires the "old-style" approach with try, fail(); and the checking the message inside catch (ExpectedException $expected), a construct we successfully removed the need for with @expect years ago. Read the full RFC here |
|