Wiki source code of Testing

Version 31.1 by Ray Kiddy on 2009/07/29 15:59

Hide last authors
Ray Kiddy 31.1 1 I have checked in changes to the ant build files. The result of these is:
Greg.Brown 27.1 2
Ray Kiddy 31.1 3 1) If you do a build as you used to do a build, there should be no change.
Henrique Prange 13.1 4
Ray Kiddy 31.1 5 2) There are two targets at the top-level:
Henrique Prange 13.1 6
Ray Kiddy 31.1 7     test-all - does a clean and then build of frameworks,applications, and examples with Dinclude.tests=true.
Henrique Prange 13.1 8
Ray Kiddy 31.1 9     test-run - calls a junit test on selected projects
Henrique Prange 13.1 10
Ray Kiddy 31.1 11 3) If the "test-all" target is invoked, then, in addition to any test sources being built in the other projects, the Wonder/Tests/ERXTest project is built. Is anyone involved in that project? If not, no harm, no foul.
Henrique Prange 13.1 12
Ray Kiddy 31.1 13 4) I added a little stub of a test to ERExtensions. It does nothing right now.
Henrique Prange 13.1 14
Ray Kiddy 31.1 15 5) I added a top-level target for "build" in Wonder/build.xml, just because it should be there.
Henrique Prange 13.1 16
Ray Kiddy 31.1 17 Various things are needed to enable testing in a project:
Henrique Prange 13.1 18
Ray Kiddy 31.1 19 1) There must be a "Tests" directory in the top level of the project. So chill has spoken and thus it shall be done. Put junit test java sources under that.
Henrique Prange 13.1 20
Ray Kiddy 31.1 21 2) There must be a parameter which defines the main test class. This could be a TestSuite, which would then invoke all the tests in the project. For example, the "ERChronic.all" target in the Build/build/build.xml file now includes the line:
Henrique Prange 13.1 22
Ray Kiddy 31.1 23 &nbsp;&nbsp; &nbsp;<param name="test.className" value="er.chronic.ChronicTestSuite" />
24
25 If there is no Tests directory in a project or if there are no sources in the Tests directory, then a build for testing does nothing more than a normal build.
26
27 If there is no test.className property set in a project's target, then a build for testing does nothing more than a normal build.
28
29 If there is no test.className property or there are no test classes in the jar files in the build root, then no tests from that project will be run. An example of a "test-run" appears below.