简体   繁体   English

NUnit 3控制台运行程序-如何运行特定的.playlist文件?

[英]NUnit 3 console runner - How to run a specific .playlist file?

Is it possible to use the NUnit3 Console Runner to run a .playlist file saved from Visual Studio's Test Explorer? 是否可以使用NUnit3控制台运行器来运行从Visual Studio的测试资源管理器中保存的.playlist文件?

I looked into the documentation but couldn't find anything for a .playlist file. 我查看了文档,但找不到.playlist文件的任何内容。 Only for a file containing a list of project names. 仅适用于包含项目名称列表的文件。 But a list is different from a xml .playlist file. 但是列表与xml .playlist文件不同。

No, there is currently no option to run a Visual Studio .playlist file in the core functionality of the console runner. 不,当前在控制台运行程序的核心功能中没有运行Visual Studio .playlist文件的选项。

The closest equivalent currently in NUnit is --testList , which is a file just containing the names of every test. 当前在NUnit中最接近的等效项是--testList ,这是一个仅包含每个测试名称的文件。 Looking at a playlist file, it looks like it would be simple-ish to write something to extract the testnames from a playlist and turn it into a testlist. 查看播放列表文件,似乎很简单,可以编写一些东西从播放列表中提取测试名称并将其转换为测试列表。

The other thing I thought briefly about was whether it would be possible to implement a .playlist file reader using the NUnit Console extensibility functionality. 我简要考虑过的另一件事是,是否可以使用NUnit Console扩展功能来实现.playlist文件阅读器。 I don't think it would be currently - as there's no extensibility around setting the test filter - but someone may correct me on that one. 认为目前不会-因为设置测试过滤器没有扩展性-但是有人可以在该过滤器上纠正我。 Would be an interesting new feature for the extensibility too! 扩展性也将是一个有趣的新功能!

Figured I'd save someone else the trouble. 想通了我会救别人的麻烦。 I put together a stylesheet that will convert these into the text files that NUnit needs. 我整理了一个样式表,将其转换为NUnit所需的文本文件。 I named it ToText.xlst . 我将其命名为ToText.xlst

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
    <xsl:template match="Add">
        <xsl:value-of select="@Test" />
        <!-- adds a newline -->
        <xsl:text>&#xa;</xsl:text>
    </xsl:template>
    <xsl:template match="@* | node()">
        <xsl:apply-templates select="*" />
    </xsl:template>
</xsl:stylesheet>

Find a copy of saxon and run it like this: 查找撒克逊人的副本并按以下方式运行:

set SAXON="path/to/saxon-a.b.c.d.jar"
java -jar %SAXON% -s:"path/to/Unit Test Playlists/Fast.playlist" -xsl:"path/to/Unit Test Playlists/ToText.xslt" -o:"path/to/Unit Test Playlists/Fast.txt"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用NUnit Console Runner在文件夹下运行所有​​测试 - Use NUnit Console Runner to run all tests under a folder 如何在Visual Studio中从CS文件为NUnit控制台运行程序创建DLL文件 - How to create a dll-file from cs-files for nunit-console runner in visual studio 使用 nunit3-console runner 时查找配置文件时出错 - Error finding configuration file when using nunit3-console runner NUnit 3.0 是否有 nunit-console-runner.dll? - Is there a nunit-console-runner.dll for NUnit 3.0? 我可以从命令行按顺序运行多个nunit测试吗?(使用nunit控制台运行程序) - Can I run multiple nunit tests sequentially from command line?(using nunit console runner) 从控制台运行器的多个程序集中并行运行 NUnit3 测试 - Run NUnit3 tests in parallel from multiple assemblies from console runner Teamcity Nunit 3.0控制台运行器无法正常工作 - Teamcity Nunit 3.0 Console Runner not working 在Nunit控制台运行器中使用类别表达式 - Using category expressions in Nunit console runner 列出所有使用NUnit控制台运行程序的测试 - List all tests with NUnit console runner GlobalMemoryStatus函数在NUnit控制台运行中报告无效的可用页面文件 - GlobalMemoryStatus function reports invalid available page file in NUnit console run
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM