PageRenderTime 18ms CodeModel.GetById 17ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/fcl-xml/tests/README_DOM.txt

https://github.com/slibre/freepascal
Plain Text | 89 lines | 65 code | 24 blank | 0 comment | 0 complexity | 3a575156a444e110479253e2c88c670e MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1Testing FCL DOM implementation with official test suite from w3.org
 2-------------------------------------------------------------------
 3
 4*** IMPORTANT: READ CAREFULLY!
 5
 6IF YOU ARE ABOUT TO RUN THESE TESTS, CONSIDER DOING SO IN AN ENVIRONMENT
 7THAT YOU MAY ALLOW TO BE TRASHED.
 8
 9As of writing this at 3 June 2008, FCL DOM memory model is
10not compatible - at all - with the way that w3.org tests use. In
11particular, tests acquire (and use) references to objects that DOM
12implementation frees. Therefore, running the tests WILL result in heap
13corruption, executing arbitrary code, and any other imaginable kind of
14disaster. Be warned.
15
16[Update: This was fixed in SVN revision 13196, dated 26 May 2009.]
17
18*** End of notice
19--------------------------------------------------------------------
20
21The fcl-xml package support for testing its DOM implementation consists of
22the following files:
23
241) testgen.pp  - an utility for generating Pascal source from XML descriptions.
252) api.xml     - database used by testgen.
263) domunit.pp  - FPCUnit extensions required at runtime.
274) extras.pp   - Additional tests, not present in w3.org testsuite.
285) extras2.pp  - Some tests that are present in the testsuite, but converted/modified
29                 by hand because automatic conversion is not yet possible.
306) README_DOM.txt - this file.
31
32
33To test the FCL DOM implementation, follow these steps:
34
351) Checkout the DOM test suite from w3.org CVS repository. The project name is
362001/DOM-Test-Suite. Only 'tests' subdirectory is needed, everything else
37is irrelevant for our purposes.
38Use the following commands:
39
40  CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public
41  cvs login
42  (enter the password anonymous when prompted)
43  cvs checkout 2001/DOM-Test-Suite/tests
44
452) Compile the testgen utility. A simple
46
47  fpc testgen.pp
48
49should do it.
50
513) Use testgen to convert DOM test suites into Pascal code. Specify path to the
52directory that contains 'alltests.xml' file, and the name of resulting FPC unit.
53Testgen expects the API description file 'api.xml' present in its directory.
54Successful conversion of the following test modules is possible:
55
56Level 1 Core (527 tests):
57  testgen 2001/DOM-Test-Suite/tests/level1/core core1.pp
58
59Level 2 Core (282 tests):
60  testgen 2001/DOM-Test-Suite/tests/level2/core core2.pp
61  
62Level 2 HTML (677 out of 685 tests, only conversion -- not runnable yet):
63  testgen 2001/DOM-Test-Suite/tests/level2/html html2.pp
64
65Level 3 Core (partial only, 131 out of 722 tests):
66  testgen 2001/DOM-Test-Suite/tests/level3/core core3.pp
67  
68Level 3 XPath (63 tests, only conversion -- not runnable yet):
69  testgen 2001/DOM-Test-Suite/tests/level3/xpath xpath3.pp
70
71In the examples above, output names (core1.pp, etc.) carry no defined meaning, except
72they are used to construct test names which appear in the test reports. The test name
73is constructed from the unit name by removing the extension and adding a 'TTest' prefix.
74
75Normally, tests that contain properties/methods unsupported by FCL DOM, or
76other elements not yet known to testgen, will be skipped. The conversion may be forced
77by using -f commandline switch, but in this case the resulting Pascal unit will likely
78fail to compile.
79 
804) Now, pick up your preferred fpcunit test runner, add the generated units to its
81uses clause, and compile. You may as well add the suppied 'extras.pp' and 'extras2.pp'
82units. During compilation, path to 'domunit.pp' should be added to the unit search
83paths.
84
855) During runtime, tests must be able to read test files which are located
86within CVS source tree ('files' subdirectory of each module directory). For this purpose,
87each generated test class contains a function 'GetTestFilesURI' which returns the path
88that was supplied to testgen. Therefore, either use an absolute path, or ensure that both
89generated sources and the test executable are located in the same directory.