2012-06-27 2 views
0

Можете ли вы дать мне простой пример файла сборки nant, который строит тесты watin/nunit из файла .csproj со всеми необходимыми зависимостями?Watin с примером Нанта

+1

Есть несколько примеров в распределении NAnt. Посмотрите на NUnit. Также - что вы пробовали? – t3hn00b

ответ

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> 
Смежные вопросы