你能给我一个简单的 nant 构建文件示例,它从 .csproj 文件构建具有所有需要的依赖项的 watin/nunit 测试吗?
问问题
599 次
1 回答
1
这是我最终为我的项目设计的 nant 构建文件:
<?xml version="1.0"?>
<project name="WatInTests" default="test">
<include buildfile="common.properties" />
<include buildfile="properties_watin.properties" />
<property name="run.dir" value="${jenkins.jobs.dir}\<my_project>\workspace" />
<property name="currentFileset" value="${projectFileset}"/>
<property name="precondition.test" value="${currentFileset}.Tests.PreconditionTest"/>
<property name="results.folder" value="${results.dir}\${now.datetime}"/>
<target name="clean">
<delete verbose="true">
<fileset basedir="${project.build.dir}">
<include name="**\*" />
</fileset>
</delete>
<copy file="App.config"
tofile="${uitests.dir}\${currentFileset}\App.config" inputencoding="utf-8"
outputencoding="utf-8" overwrite="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
</target>
<target name="build" depends="clean">
<echo message="Start building ${currentFileset}"/>
<copy file="${nunit.reference}" todir="${uitests.dir}\${currentFileset}\bin\debug" failonerror="true"/>
<copy file="${nunit_core.reference}" todir="${uitests.dir}\${currentFileset}\bin\debug" failonerror="true"/>
<exec program="${project.utils.msbuild.exe}" workingdir="${uitests.dir}\${currentFileset}">
<arg value="${ProjectSlnPath}"></arg>
<arg value="/p:Configuration=${BuildMode}"></arg>
</exec>
<echo message="Build succeeded"/>
<echo message="Copy build to ${run.dir}"/>
<copy todir="${run.dir}" overwrite="true">
<fileset basedir="${watintests.dir}\${currentFileset}\bin\debug">
<exclude name="*.svn" />
</fileset>
</copy>
</target>
<target name="precondition" depends="build">
<mkdir dir="${results.folder}" />
<exec program="${nunit.file}" failonerror="true" verbose="true" workingdir="${run.dir}">
<arg value="/run:${precondition.test}" />
<arg value="${run.dir}\${nunit.config.file}" />
</exec>
</target>
<target name="test" depends="precondition">
<exec program="${nunit.file}" verbose="true" workingdir="${run.dir}">
<arg value="/exclude:Precondition" />
<arg value="${run.dir}\${nunit.config.file}" />
</exec>
<copy file="${run.dir}\TestResult.xml" todir="${results.folder}" failonerror="true"/>
</target>
</project>
于 2012-07-24T15:11:06.930 回答