Wiki source code of Testing

Version 21.1 by Ray Kiddy on 2009/07/29 16:18

Hide last authors
Ray Kiddy 21.1 1 There are many documents relevant to testing that should be evaluated for veracity, usefulness and relevance:
Henrique Prange 13.1 2
Ray Kiddy 21.1 3 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Project+WONDER-Frameworks-ERSelenium
4 * http:~/~/wiki.objectstyle.org/confluence/display/WONDER/Selenium+Introduction
5 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Web+Services-Testing+Services+with+Terminal
6 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Testing+and+JUnit
7 * http:~/~/wiki.objectstyle.org/confluence/display/WONDER/How+to+Develop+Selenium+Tests
8 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-Load+Testing+WO+Apps+with+JMeter
9 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-JUnit
10 * http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-WOUnitTest
Henrique Prange 13.1 11
Ray Kiddy 21.1 12 == Junit Testing of Project Wonder in Ant Builds ==
Henrique Prange 13.1 13
Ray Kiddy 21.1 14 I have checked in changes to the ant build files. The result of these is:
Henrique Prange 13.1 15
Ray Kiddy 21.1 16 1. 1) If you do a build as you used to do a build, there should be no change.
17 1. 2) There are two targets at the top-level:
18 1*. test-all - does a clean and then build of frameworks,applications, and examples with Dinclude.tests=true.
19 1*. test-run - calls a junit test on selected proje
20 1. 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.
21 1. 4) I added a little stub of a test to ERExtensions. It does nothing right now.
22 1. 5) I added a top-level target for "build" in Wonder/build.xml, just because it should be there.
Henrique Prange 13.1 23
Ray Kiddy 21.1 24 Various things are needed to enable testing in a project:
Henrique Prange 13.1 25
Ray Kiddy 21.1 26 1. 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.
27 1. 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:
28 1*. <param name="test.className" value="er.chronic.ChronicTestSuite" />
Henrique Prange 13.1 29
Ray Kiddy 21.1 30 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. 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. 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.\\
Henrique Prange 13.1 31
Ray Kiddy 21.1 32 {{code}}
Henrique Prange 13.1 33
Ray Kiddy 21.1 34 % cd Wonder
35 % ant tests.run
36 Buildfile: build.xml
Henrique Prange 13.1 37
Ray Kiddy 21.1 38 tests.run:
Henrique Prange 13.1 39
Ray Kiddy 21.1 40 tests.run:
41
42 ERExtensions.all:
43
44 global.environment:
45
46 global.properties:
47
48 global.framework.test:
49     [junit] Testsuite: er.extensions.statistics.ERXMetricsTest
50     [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.002 sec
51     [junit]
52
53 ERChronic.all:
54
55 global.environment:
56
57 global.properties:
58
59 global.framework.test:
60     [junit] Testsuite: er.chronic.ChronicTestSuite
61     [junit] Tests run: 74, Failures: 0, Errors: 0, Time elapsed: 0.355 sec
62     [junit]
63
64 BUILD SUCCESSFUL
65 Total time: 0 seconds
66
67 {{/code}}
68
69 \\