-1

我正在开发 dotnet 2008、Nunit 2.6、Nant0.91 应用程序。我正在使用 log4net 进行日志记录。

当尝试通过 Nunit 运行测试用例时,会生成一个日志文件,但是当我尝试通过 Nant 运行它时,我无法运行我的测试用例。

我正在粘贴我的构建文件中存在的完整信息:

<?xml version="1.0" encoding="utf-8"?>
<project name="w2" default="run" basedir=".">
    <!--Here we are building DLL -->
    <target name="build">
        <mkdir dir="Libraries" />
        <mkdir dir="Output"/>
        <csc target="library" output="Libraries/${project::get-
        name()}.dll">
            <sources>
                <include name="C:\\Users\\rm99699\\Documents\\Visual Studio
        2008\\Projects\\w2\\w2\\*.cs" />
                <include name="C:\\Users\\rm99699\\Documents\\Visual Studio 2008\
        \Projects\\w2\\w2\\app.config.xml"/>
            </sources>
            <references basedir="Libraries">
                <include name="${nant::scan-probing-
        paths('nunit.framework.dll')}" />
                <include name="${nant::scan-probing-paths('log4net.dll')}" />
                <include name="D:\selenium-
        dotnet-2.8.0\net35\WebDriver.dll" />
                <include name="D:\selenium-
        dotnet-2.8.0\net35\WebDriver.Support.dll" />
                <include name="D:\selenium-
        dotnet-2.8.0\net35\ThoughtWorks.Selenium.Core.dll" />
            </references>
        </csc>
    </target>

    <!--Here we are running testcases -->

    <target name="run" depends="build">
        <nunit2 failonerror="false" >
            <formatter type="Xml" usefile="true" extension=".xml"
                       outputdir="Output"/>
            <test assemblyname="C:\\Users\\rm99699\\Documents\\Visual Studio 2008\
        \Projects\\w2\\w2\\Libraries\\w2.dll"  appconfig="C:\\Users\\rm99699\
        \Documents\\Visual Studio 2008\\Projects\\w2\\w2\\app.config">
                <references basedir="Libraries">
                    <include name="${nant::scan-probing-
        paths('nunit.framework.dll')}" />
                    <include name="D:\selenium-dotnet-2.8.0\net35\WebDriver.dll" />
                    <include name="D:\selenium-
        dotnet-2.8.0\net35\WebDriver.Support.dll" />
                    <include name="D:\selenium-
        dotnet-2.8.0\net35\ThoughtWorks.Selenium.Core.dll" />
                    <include name ="D:\nant-0.91-bin\nant-0.91\bin\lib\common
        \2.0\log4net.dll" />
                    <!-- <include name="${nant::scan-probing-paths('log4net.dll')}" />-->
                </references>
            </test>
        </nunit2>
    </target>
</project> 

根据我的构建文件,是否有任何可见的错误阻止我运行我的测试用例?

4

1 回答 1

0

什么是控制台输出?NAnt 在其核心中包含 log4net,我已经看到当代码使用与 NAnt 不同版本的 log4net 时会导致问题的情况。您可以尝试使用<exec>任务来运行单元测试——尤其是因为 NAnt 的<nunit2>任务使用了极其过时的 NUnit 2.2。

于 2012-05-23T06:49:58.657 回答