Information Technology Reference
In-Depth Information
<target name="integrate-database">
<sql connstring="${project.db.conn}"
delimiter=";"
delimstyle="Normal"
print="true"
source="${data-definitions}"/>
</target>
Listing 4-4 is an example of running the
nunit2
task in NAnt to
execute a suite of NUnit tests. Notice that if any of the tests fail, the
build fails (as demonstrated by setting the
failonerror
attribute of
the
nunit2
task to
true
). As the CI practice stated in Chapter 2,
all
tests and inspections must pass
in order for a build to pass.
Testing Using NUnit and NAnt
LISTING 4-4
<target name="run-tests" depends="compile-src">
<nunit2 failonerror="true">
<formatter type="Xml"
usefile="true"
extension=".xml"
outputdir="${build.dir}/results"/>
<test
assemblyname="${build.dir}\bin\${config}\${project}.Test.dll"
appconfig="mydefaulttest.config"/>
</nunit2>
</target>
Listing 4-5 demonstrates the execution of the
fxcop
task, which
runs FxCop, a free tool for the .NET platform that inspects and reports
on predefined code violations relating to performance, security con-
cerns, naming conventions, and so on.
LISTING 4-5
Inspection Using FxCop and NAnt
<target name="fxcop">
<fxcop>
<targets>
<include
name="${build.dir}\bin\${config}\${project}.dll"/>
</targets>
<arg value="/out:${build.dir}\bin\${config}\fxcop.xml"/>
</fxcop>
</target>