21 ============================================================================ |
21 ============================================================================ |
22 --> |
22 --> |
23 <project name="test-diamonds" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium"> |
23 <project name="test-diamonds" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium"> |
24 <description>Helium Antlib diamonds unittests.</description> |
24 <description>Helium Antlib diamonds unittests.</description> |
25 |
25 |
26 |
26 <taskdef name="xpathtest" classname="se.jtech.ant.xpath.XPathEvaluatorTask" onerror="ignore"/> |
|
27 |
27 <import file="run-scenario.ant.xml" /> |
28 <import file="run-scenario.ant.xml" /> |
28 |
29 |
29 <target name="test-build"> |
30 <target name="test-build"> |
30 <runScenario scenario="build" target="unittest-diamonds" /> |
31 <runScenario scenario="build" target="unittest-diamonds" /> |
|
32 <au:assertLogContains text="Diamonds build id:" /> |
31 </target> |
33 </target> |
32 |
34 |
33 <target name="test-build-with-invalid-address"> |
35 <target name="test-build-with-invalid-address"> |
34 <runScenario scenario="invalid-address" target="unittest-diamonds" /> |
36 <runScenario scenario="invalid-address" target="unittest-diamonds" /> |
35 <au:assertLogContains text="Error occured while sending mail" /> |
37 <au:assertLogContains text="Error sending the message: invalid.server.local" /> |
|
38 <au:assertLogContains text="Diamonds reporting will be disabled." /> |
36 </target> |
39 </target> |
37 |
40 |
38 <target name="test-build-with-invalid-templates"> |
41 <target name="test-build-with-invalid-templates"> |
39 <runScenario scenario="invalid-templates" target="unittest-diamonds" /> |
42 <runScenario scenario="invalid-templates" target="unittest-diamonds" /> |
|
43 <au:assertLogContains text="Error with invalid-ant-properties-input-file.ftl" /> |
|
44 <au:assertLogContains text="Diamonds build id:" /> |
40 </target> |
45 </target> |
41 |
46 |
42 <target name="test-build-with-invalid-templates-1"> |
47 <target name="test-build-with-invalid-templates-1"> |
43 <runScenario scenario="invalid-templates-1" failonerror="false" target="unittest-diamonds" /> |
48 <runScenario scenario="invalid-templates-1" target="unittest-diamonds" /> |
|
49 <au:assertLogContains text="Diamonds build id:" /> |
|
50 </target> |
|
51 |
|
52 <target name="test-build-without-config"> |
|
53 <runScenario scenario="build-without-config" target="unittest-diamonds" /> |
|
54 <au:assertLogContains text="Diamonds reporting is disabled, because the listener is not configured properly: required property: diamonds.host not defined" /> |
|
55 </target> |
|
56 |
|
57 <target name="test-failing-build"> |
|
58 <au:expectfailure> |
|
59 <runScenario scenario="failing-build" target="build" /> |
|
60 </au:expectfailure> |
|
61 <au:assertLogContains text="BUILD FAILED" /> |
|
62 <au:assertLogContains text="diamonds:" /> |
|
63 <au:assertLogContains text="failing-target:" /> |
|
64 <property file="${test.temp.dir}/diamonds.ini" /> |
|
65 <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml" |
|
66 dest="${test.temp.dir}/diamonds_data.xml" |
|
67 usetimestamp="true" /> |
|
68 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
69 <namespace uri="" prefix=""/> |
|
70 <xpath expression="/diamonds-build/build[status='failed']"/> |
|
71 </xpathtest> |
|
72 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
73 <namespace uri="" prefix=""/> |
|
74 <xpath expression="/diamonds-build/build/finished"/> |
|
75 </xpathtest> |
|
76 </target> |
|
77 |
|
78 <target name="test-signal-build"> |
|
79 <au:expectfailure> |
|
80 <runScenario scenario="signal-build" target="build" /> |
|
81 </au:expectfailure> |
|
82 <au:assertLogContains text="BUILD FAILED" /> |
|
83 <au:assertLogContains text="diamonds:" /> |
|
84 <au:assertLogContains text="failing-target:" /> |
|
85 <property file="${test.temp.dir}/diamonds.ini" /> |
|
86 <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml" |
|
87 dest="${test.temp.dir}/diamonds_data.xml" |
|
88 usetimestamp="true" /> |
|
89 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
90 <namespace uri="" prefix=""/> |
|
91 <xpath expression="/diamonds-build/build[status='failed']"/> |
|
92 </xpathtest> |
|
93 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
94 <namespace uri="" prefix=""/> |
|
95 <xpath expression="/diamonds-build/build/finished"/> |
|
96 </xpathtest> |
|
97 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
98 <namespace uri="" prefix=""/> |
|
99 <xpath expression="/diamonds-build/signals/signal[position()=1 and name='testDeferredSignalInput']"/> |
|
100 </xpathtest> |
|
101 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
102 <namespace uri="" prefix=""/> |
|
103 <xpath expression="/diamonds-build/signals/signal[position()=2 and name='testNowSignalInput']"/> |
|
104 </xpathtest> |
|
105 </target> |
|
106 |
|
107 <target name="test-target-recording"> |
|
108 <runScenario scenario="target-recording" target="build" /> |
|
109 <au:assertLogContains text="BUILD SUCCESSFUL" /> |
|
110 <au:assertLogContains text="diamonds:" /> |
|
111 <property file="${test.temp.dir}/diamonds.ini" /> |
|
112 <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml" |
|
113 dest="${test.temp.dir}/diamonds_data.xml" |
|
114 usetimestamp="true" /> |
|
115 <xpathtest xmlfile="${test.temp.dir}/diamonds_data.xml"> |
|
116 <namespace uri="" prefix=""/> |
|
117 <xpath expression="/diamonds-build/targets/target[name='target-recording']"/> |
|
118 <xpath expression="/diamonds-build/targets/target[name='sub-target2']"/> |
|
119 <xpath expression="/diamonds-build/targets/target[name='sub-target3']"/> |
|
120 <xpath expression="/diamonds-build/targets[count(target)=3]"/> |
|
121 </xpathtest> |
44 </target> |
122 </target> |
45 |
123 |
46 </project> |
124 </project> |