[Webtest] Tweaks to Ant Build File to easily run singletest
Eric Pugh
webtest@lists.canoo.com
Fri, 12 Apr 2002 14:20:43 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_0001_01C1E465.C2FF0FD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi all,
I was trying to change the selfTest build file for my own site, and ran into
some oddnesses that I fixed in my version, but might make sense to backport.
One is that the target "main" that you think would be the default, is not.
Instead it is CreateSummaryReport. Also, there is no way to run a single
test, and then create the report off that. And if you are building a long
list of tests to run from main, it helps to be able to be able to
dynamically run one.
I have copied below the relavant portions of my ant file. Basically I
changed main to be the default target, and made CreateSummaryReport not
depend on anyone else. I then added a target singletest that you can call
with a test to run: ant -f myfile.xml
singletest -Dtestcase=mysingletestcase . I chose the name singletest
because that is what the Jakarta Maven project uses as the target for
running one test case. If this is a change people want, then I can submit a
CVS diff if that is better.
Eric Pugh
<!-- ALL TEST TO BE RUN -->
<target name="main" depends="prepareResultDir,
testWorkOrderList,testWorkorderEditPage,
testCompoundListPage
">
<antcall target="CreateSummaryReport"/>
</target>
<!-- SINGLE TEST TO BE RUN -->
<!-- run whatever testcase is passed in vid a -Dtestcase=mytest -->
<target name="singletest">
<antcall target="${testcase}"/>
<antcall target="CreateSummaryReport"/>
</target>
<!--
.
.
.
.
all the test cases
.
.
. -->
<target name="CreateSummaryReport">
<copy file="${base.dir}/report.css" todir="${resultpath}"/>
<copy file="${base.dir}/../info/manual/Services.css"
todir="${resultpath}"/>
<copy file="${resultpath}/${resultfile}" todir="${base.dir}"/>
<tstamp>
<format property="report.time" pattern="dd.MM.yyyy hh:mm:ss"/>
</tstamp>
<ant antfile="${base.dir}/ApplyXSL.xml" target="applySingle">
<!-- report.time already set -->
<property name="resultpath" value="${base.dir}"/>
<property name="resultfile" value="WebTestReport.xml"/>
<property name="resultfile.html" value="TestResultOverview.html"/>
<property name="style" value="${base.dir}/WebTestReport.xsl"/>
</ant>
<move file="${base.dir}/TestResultOverview.html" todir="${resultpath}"/>
<delete file="${base.dir}/${resultfile}" />
</target>
------=_NextPart_000_0001_01C1E465.C2FF0FD0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office" xmlns:w =3D=20
"urn:schemas-microsoft-com:office:word"><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META content=3DWord.Document name=3DProgId>
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<META content=3D"Microsoft Word 9" name=3DOriginator><LINK=20
href=3D"cid:filelist.xml@01C1E155.2B30C210" rel=3DFile-List><!--[if gte =
mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
</w:WordDocument>
</xml><![endif]-->
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in =
1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; =
mso-paper-source: 0; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
P.MsoAutoSig {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoAutoSig {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoAutoSig {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
SPAN.EmailStyle18 {
COLOR: black; mso-style-type: personal; mso-ansi-font-size: 10.0pt; =
mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; =
mso-bidi-font-family: Arial
}
SPAN.EmailStyle19 {
COLOR: navy; mso-style-type: personal-reply; mso-ansi-font-size: =
10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; =
mso-bidi-font-family: Arial
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=3DEN-US style=3D"tab-interval: .5in" vLink=3Dpurple =
link=3Dblue>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2>H<SPAN class=3D236411518-12042002>i=20
all,</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>I was trying to change the =
selfTest build=20
file for my own site, and ran into some oddnesses that I fixed in my =
version,=20
but might make sense to =
backport.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>One is that the target "main" =
that you=20
think would be the default, is not. Instead it is=20
CreateSummaryReport. Also, there is no way to run a single test, =
and then=20
create the report off that. And if you are building a long list of =
tests=20
to run from main, it helps to be able to be able to dynamically run =
one.<![if !supportEmptyParas]><![endif]><![if =
!supportEmptyParas]><![endif]><![if =
!supportEmptyParas]><![endif]></SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>I have copied below the =
relavant portions=20
of my ant file. Basically I changed main to be the default target, =
and=20
made CreateSummaryReport not depend on anyone else. I then added a =
target=20
singletest that you can call with a test to run: ant -f myfile.xml =
singletest -Dtestcase=3Dmysingletestcase . I chose the name =
singletest=20
because that is what the Jakarta Maven project uses as the target for =
running=20
one test case. If this is a change people want, then I can =
submit a=20
CVS diff if that is better.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>Eric=20
Pugh</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002><!-- ALL TEST TO BE =
RUN=20
--></SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002> <target name=3D"main" =
depends=3D"prepareResultDir,=20
testWorkOrderList,testWorkorderEditPage,<BR> testCompoundListP=
age<BR> "><BR> <antcall=20
target=3D"CreateSummaryReport"/><BR> </target></SPAN></FONT=
></FONT></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002><!-- SINGLE TEST TO BE RUN=20
--><BR> <!-- run whatever testcase is passed in vid a=20
-Dtestcase=3Dmytest --> =
<BR> =20
<target name=3D"singletest"><BR> <antcall=20
target=3D"${testcase}"/> =20
<BR> <antcall=20
target=3D"CreateSummaryReport"/><BR> =20
</target><BR></SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002><!--=20
</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>all the test=20
cases</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN =
class=3D236411518-12042002>.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002>.=20
--></DIV></SPAN></FONT></FONT></FONT></SPAN>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN=20
class=3D236411518-12042002></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D236411518-12042002><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D236411518-12042002> <target=20
name=3D"CreateSummaryReport"><BR> <copy=20
file=3D"${base.dir}/report.css" =
todir=3D"${resultpath}"/><BR> <copy=20
file=3D"${base.dir}/../info/manual/Services.css"=20
todir=3D"${resultpath}"/><BR> <copy=20
file=3D"${resultpath}/${resultfile}"=20
todir=3D"${base.dir}"/><BR> <tstamp><BR> &=
nbsp; =20
<format property=3D"report.time" pattern=3D"dd.MM.yyyy=20
hh:mm:ss"/><BR> </tstamp><BR> <ant=20
antfile=3D"${base.dir}/ApplyXSL.xml"=20
target=3D"applySingle"><BR> <!-- =
report.time =20
already set --><BR> <property =
name=3D"resultpath"=20
value=3D"${base.dir}"/><BR> <property=20
name=3D"resultfile"=20
value=3D"WebTestReport.xml"/><BR> <property =
name=3D"resultfile.html"=20
value=3D"TestResultOverview.html"/><BR> <pro=
perty=20
name=3D"style"=20
value=3D"${base.dir}/WebTestReport.xsl"/><BR> </ant><=
BR> <move=20
file=3D"${base.dir}/TestResultOverview.html"=20
todir=3D"${resultpath}"/><BR> <delete=20
file=3D"${base.dir}/${resultfile}" /><BR> =20
</target><BR></DIV></SPAN></FONT></FONT></FONT></SPAN></BODY>=
</HTML>
------=_NextPart_000_0001_01C1E465.C2FF0FD0--