5.4 ProblemsTop5.2 Implementation5.3 Tests



5.3 Tests

5.3.1 Component Tests

Component tests were set up at the beginning of the implementation, taking into account the distinctiveness of asynchronous function commands in automatic zoom animations (see Section 4.5.1). The following two notable characteristics were observed during the use of the delay_call method:

  1. According to the delay_call method, no additional test assertion which builds upon assertions and instructions of the delay_call method can follow within a test function. Otherwise the test function will fail.
    Background: Because of the determined delay time, instructions that follow the delay_call method are preferred and therefore processed before delay_call() is carried out. As a result, the generated component tests always set delay_call() as the last instruction in test functions (see Listing 5.3.1; line 33/34).
  2. Test functions involving several automatic zoom animations require a corresponding number of delay_call commands. According to (1) these cannot be listed in consecutive order. One solution would be to interleave them; ie. to executive a command within an existing command. However, a more elegant solution is to list the individual functions and their delay times in the parameter list of one delay_call method (see Listing 5.3.1).

Appropriate component tests were developed for almost all newly implemented (modified) functions of OpenLayers (see Classification Diagram in Appendix 6.3). In doing so, three new test pages were created: test_WMS_Untiled.html, test_MouseDefaults.html and test_KeyboardDefaults.html. The remaining test files were expanded with new methods. The implementation of animated zooming resulted in a further required adjustment and expansion (with delay_call methods) of test functions which test zoom performance.

Towards the end of the implementation all tests were carried out successfully. The component tests provided a quality assurance aspect and thus ensured the correctness of the animated zooming und panning features for future extensions.

Listing: multiple delay_call commands in a test function; test_Map.html

function test_05_Map_center(t) {
    map = new OpenLayers.Map('map');
    var baseLayer = new OpenLayers.Layer.WMS("Test Layer", "http://octo.metacarta.com/cgi-bin/mapserv?",
        {map: "/mapdata/vmap_wms.map", layers: "basic"} );
    var ll = new OpenLayers.LonLat(2,1);
    map.setCenter(ll, 0);
        1, function() {
            t.eq( map.getZoom(), 1, "map.zoom is correct after calling setCenter,zoom in");     
            t.ok( map.getCenter().equals(ll), "map center is correct after calling setCenter, zoom in");
            // set zoomanimation flag manually,
            // reason: loadend event in layers.js will not achieved in unittests
            map.zoomanimationActive = false;
        1, function() {
            t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
        1, function() {
            t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" );
        1, function() {
            t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToMaxExtent" );
            var lonlat = map.getCenter();
            var zero = new OpenLayers.LonLat(0, 0);
            t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" );

5.3.2 Integration Tests

After completion of the implementation the initial test plan was adapted to the actually implemented functions. The final test plan is divided into seven test suites (see Appendix 6.3).

The complete test was carried out in seven different browsers, and a test log for each was compiled. Table 5.3.2 illustrates the tested browser version, divided by operating systems used.

Debian GNU/Linux 3.1

Mac OS 10.4 Windows XP
Firefox 2.0.4Internet Explorer 7.0
Bon Echo
Tested Browser Versions
Opera 9.10ign="left">

KDE Konqueror46 (Version 3.5.5 and 3.3.2) is not supposed to be supported by OpenLayers - this was also checked as part of the testing process (see also OpenLayers). During an attempt to run the demo the map was not loaded (ie. the map window remained empty). Even after posting a question on the OpenLayers developer's mailing list the reason for this could not be found.

The test run using Internet Explorer (IE) 7 uncovered three problem areas:

  1. The following test plan question was always checked with a No:
    »Does the status bar of the browser show the completion of the map loading process (e.g. confirm that it is done)?«
  2. Zooming using the keyboard did not work in IE.
  3. PNG tile graphics became invisible once they exceeded 32768 pixels during the scaling process. CPU load also jumped considerably. Sometimes IE did not respond temporarily or it crashed completely.

Item (1) can be neglected, as it does not impair the functional performance of the application. A search for a solution to this browser-specific problem was not carried out.
Problem (2) also only occured in IE. With the addition of two IE-specific keycodes for the + and - key the problem was solved (see KeyboardDefaults.js).
The basic problem of item (3), that tile graphics above 32768 pixels are no longer shown, was also observed in the three browsers tested in Mac OS X and Firefox in Windows. It stands to reason that graphics in these browsers are only displayed at maximum 16 bits, ie. 1 bit for pre-drawing and 15 for the size number, hence 215=32768 px. The above-mentioned performance problems observed in IE are serious enough that they warrant an urgent solution to ensure the reliability of the application.

Since IE does not seem to capture pixels exceeding 215, the application needs to compensate for this problem. Prior to scaling a tile, OpenLayers now checks in the methods scaleTileTo(), scaleTilesOfGrid() and scaleZoomOutTile_share() (in Layer.js) whether the above-mentioned value has been exceeded. If that is the case, no further scaling takes place and the tiles stay at their most recent tile size. This has no real significance for the user, since at 32768 pixels the map is already highly pixelated. However, the fact that after a certain zoom level the map does not continue to adjust in line with the movement on the zoom slider can be somewhat irritating for the user, with a corresponding negative effect on Smart Map Browsing.

The implemented integration tests form the concluding part of the implementation and test phase. They also highlight the importance of test logs for quality assurance purposes, as shown by the discovery of new problem areas.

© June 1, 2007 | Emanuel Schütze | some rights reserved.
This work is licensed under the Creative Commons License Attribution-ShareAlike 2.0 Germany.

5.4 ProblemsTop5.2 Implementation5.3 TestsContentsGerman