2010-12-13 4 views
6

Tôi cần đầu ra NUnit từ các thử nghiệm XUnit cho một báo cáo. Với NUnit tôi có thể làm:Làm cách nào để xuất NUnit định dạng xml bằng giao diện điều khiển XUnit?

nunit-console.exe /xml=c:\TestResultN.xml MyDll.dll 

Tôi đã thử:

xunit.console MyDll.dll /nunit TestResults.xml 

nhưng tôi nhận được:

unknown output transform: nunit 

Bất kỳ tài liệu tốt về xUnit console? Tôi không thể tìm thấy bất kỳ thông tin nào.

Trả lời

19

Nhập xunit.console.exe /? vào bảng điều khiển và xem ở cuối danh sách tùy chọn.

> xunit.console.exe /? 
xUnit.net console test runner (64-bit .NET 2.0.50727.4952) 
Copyright (C) 2007-10 Microsoft Corporation. 

usage: xunit.console <xunitProjectFile> [options] 
usage: xunit.console <assemblyFile> [configFile] [options] 

Valid options: 
    /silent    : do not output running test count 
    /teamcity    : forces TeamCity mode (normally auto-detected) 
    /wait     : wait for input after completion 

Valid options for assemblies only: 
    /noshadow    : do not shadow copy assemblies 
    /xml <filename>  : output results to Xunit-style XML file 
    /html <filename>  : output results to HTML file 
    /nunit <filename>  : output results to NUnit-style XML file 

Hai tùy chọn cuối cùng được trích xuất từ ​​tệp cấu hình và bao gồm tệp xslt được áp dụng cho đầu ra của xunit. Nếu không có /nunit, hãy đảm bảo rằng bạn có tệp NUnitXml.xslt trong thư mục xunit và mục nhập nunit được khai báo trong tệp xunit.console.exe.config.

xunit.console.exe.config tập tin của tôi:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <configSections> 
    <section name="xunit" type="Xunit.ConsoleClient.XunitConsoleConfigurationSection, xunit.console"/> 
    </configSections> 

    <xunit> 
    <transforms> 
     <add 
     commandline="html" 
     xslfile="HTML.xslt" 
     description="output results to HTML file"/> 
     <add 
     commandline="nunit" 
     xslfile="NUnitXml.xslt" 
     description="output results to NUnit-style XML file"/> 
    </transforms> 
    </xunit> 

</configuration> 

Nếu bạn không thể tìm thấy file luận văn, bạn có thể cần phải cài đặt lại xUnit.