aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test.xml
blob: aa37a564aed55601297548465d1c07d5ae50737f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?xml version="1.0"?>

<project name="Testing Testing Tools" basedir="." default="run-and-clean-up">
    <!-- ================================================================== -->
    <!-- Configuration                                                      -->
    <!-- ================================================================== -->
	<property name="lib.dir" value="../build/lib/testbench" />
	<property name="class-dir" value="../build/classes" />
	<property name="test-output-dir" value="../build/test-output" />
	<property name="test-browsers" value="firefox,ie" />

	<path id="classpath">
		<fileset dir="${lib.dir}" includes="**/*.jar" />
		<pathelement path="${class-dir}" />
	</path>

	<fileset dir="../tests" id="html-test-files">
		<include name="**/*test**.html" />
	</fileset>

    <!-- ================================================================== -->
    <!-- Building Tests                                                     -->
    <!-- ================================================================== -->

	<target name="create-tests">
		<fileset id="tests">
			<include />
		</fileset>
		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />

		<java classname="com.vaadin.testingtools.util.TestConverter" classpathref="classpath">
			<arg value="${test-output-dir}" />
			<arg value="${test-browsers}" />
			<arg line="${testfiles}" />
		</java>
	</target>

	<target name="compile-tests" depends="create-tests">
        <mkdir dir="${class-dir}"/>
		<javac srcdir="${test-output-dir}" destdir="${class-dir}" debug="on">
			<classpath>
				<path refid="classpath" />
			</classpath>
		</javac>
	</target>

    <!-- ================================================================== -->
    <!-- Toolkit Server Management                                          -->
    <!-- ================================================================== -->

    <target name="server-start">
        <fail unless="package.name" message="The 'package.name' property must be defined."/>
        <fail unless="package.filename" message="The 'package.filename' property must be defined."/>
        <fail unless="testing.testarea" message="The 'testing.testarea' property must be defined."/>

        <echo>Package name: ${package.name}</echo>
        <echo>Package filename: ${package.filename}</echo>
        <echo>Testing area: ${testing.testarea}</echo>

        <exec executable="python" searchpath="true" dir=".."  resultproperty="server.start.result">
            <arg value="build/testing/toolkit-server.py"/>
            <arg value="start"/>
            <arg value="${package.name}"/>
            <arg value="${package.filename}"/>
            <arg value="${testing.testarea}"/>
        </exec>

        <condition property="server.start.succeeded">
            <equals arg1="${server.start.result}" arg2="0"/>
        </condition>
    </target>

    <target name="server-stop">
        <exec executable="python" dir=".." searchpath="true" resultproperty="server.stop.result">
            <arg value="build/testing/toolkit-server.py"/>
            <arg value="stop"/>
        </exec>
    </target>

    <!-- ================================================================== -->
    <!-- Running Tests                                                      -->
    <!-- ================================================================== -->

	<target name="check-parameters">
        <fail unless="com.vaadin.testingtools.tester.host" message="The 'com.vaadin.testingtools.tester.host' property must be defined."/>
        <fail unless="com.vaadin.testingtools.deployment.url" message="The 'com.vaadin.testingtools.deployment.url' property must be defined."/>
    </target>

	<target name="run-tests" if="server.start.succeeded" depends="execute-tests">
	</target>

	<target name="execute-tests" depends="compile-tests">
		<junit fork="yes">
			<classpath>
				<path refid="classpath" />
			</classpath>
			<jvmarg value="-Dcom.vaadin.testingtools.tester.host=${com.vaadin.testingtools.tester.host}" />
			<jvmarg value="-Dcom.vaadin.testingtools.deployment.url=${com.vaadin.testingtools.deployment.url}" />

			<batchtest>
				<fileset dir="${test-output-dir}">
					<include name="**/**.java" />
				</fileset>
			</batchtest>
		</junit>

	</target>

	<target name="remove-temp-files">
		<!-- test java files -->
		<delete>
			<fileset dir="${test-output-dir}">
				<include name="**/**.java" />
			</fileset>
		</delete>
	</target>

    <!-- ================================================================== -->
    <!-- Main Targets                                                       -->
    <!-- ================================================================== -->

    <!-- The default target. -->
	<target name="run-and-clean-up" depends="check-parameters, run-tests,remove-temp-files">
	</target>

    <!-- Also starts the server. -->
    <target name="test-package" depends="server-start, run-and-clean-up, server-stop">
    </target>

</project>