Xunit 完整的命令行选项列表
Xunit Complete List of Command Line Options
是否有人有完整的命令行选项列表,用于从控制台进行 运行ning Xunit 测试?
我有大约 100 个测试,假设分成 10 个独立的 classes,每个 class 有 10 个测试
Class1
测试1
测试2
...
Class2
测试1
测试2
...
等等
我可以通过导航到我的测试目录并使用 'dotnet test' 来触发 运行 所有这些测试。
我发现文档说 -?显示所有命令行选项(但这显然不是完整列表)https://livebook.manning.com/book/dotnet-core-in-action/appendix-b/4
官方文档https://xunit.net/docs/running-tests-in-parallel
说我可以使用例如“-parallel all”但是当它 运行
dotnet 测试 - 全部并行
我明白了
\repos\test-automation-framework\framework>dotnet 测试 - 并行所有
MSBUILD:错误 MSB1001:未知开关。
开关:-parallel
对于开关语法,键入“MSBuild -help”
我想进入一个阶段,我可以 运行 我的所有测试并行,但将线程数限制为 6,所以我将 运行 我的整个测试套件,一次 6 个测试。
我是不是遗漏了一些非常明显的东西?
如果我没有正确理解你的问题,你想将一些命令行参数传递给 Xunit。但是当你 运行 dotnet test
它实际上将参数应用于 dotnet
命令。
您可以使用 configuration files 来启用并行化和其他功能。
xunit.config.json
{
"parallelizeAssembly": true
}
您提到的论点(例如 --parallel
)确实存在,但不在 dotnet
上下文中。您可以使用 console 运行ner 手动 运行 Xunit。它作为 xunit 存储库的一部分存在于 NuGet and on GitHub 中。
这是它的输出:
$ .\xunit.console.exe
xUnit.net Console Runner v2.4.1 (64-bit Desktop .NET 4.6.1, runtime: 4.0.30319.42000)
Copyright (C) .NET Foundation.
usage: xunit.console <assemblyFile> [configFile] [assemblyFile [configFile]...] [options] [reporter] [resultFormat filename [...]]
Note: Configuration files must end in .json (for JSON) or .config (for XML)
Valid options:
-nologo : do not show the copyright message
-nocolor : do not output results with colors
-failskips : convert skipped tests into failures
-stoponfail : stop on first test failure
-parallel option : set parallelization based on option
: none - turn off all parallelization
: collections - only parallelize collections
: assemblies - only parallelize assemblies
: all - parallelize assemblies & collections
-maxthreads count : maximum thread count for collection parallelization
: default - run with default (1 thread per CPU thread)
: unlimited - run with unbounded thread count
: (number) - limit task thread pool size to 'count'
-appdomains mode : choose an app domain mode
: ifavailable - choose based on library type
: required - force app domains on
: denied - force app domains off
-noshadow : do not shadow copy assemblies
-wait : wait for input after completion
-diagnostics : enable diagnostics messages for all test assemblies
-internaldiagnostics : enable internal diagnostics messages for all test assemblies
-debug : launch the debugger to debug the tests
-serialize : serialize all test cases (for diagnostic purposes only)
-trait "name=value" : only run tests with matching name/value traits
: if specified more than once, acts as an OR operation
-notrait "name=value" : do not run tests with matching name/value traits
: if specified more than once, acts as an AND operation
-method "name" : run a given test method (can be fully specified or use a wildcard;
: i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')
: if specified more than once, acts as an OR operation
-nomethod "name" : do not run a given test method (can be fully specified or use a wildcard;
: i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')
: if specified more than once, acts as an AND operation
-class "name" : run all methods in a given test class (should be fully
: specified; i.e., 'MyNamespace.MyClass')
: if specified more than once, acts as an OR operation
-noclass "name" : do not run any methods in a given test class (should be fully
: specified; i.e., 'MyNamespace.MyClass')
: if specified more than once, acts as an AND operation
-namespace "name" : run all methods in a given namespace (i.e.,
: 'MyNamespace.MySubNamespace')
: if specified more than once, acts as an OR operation
-nonamespace "name" : do not run any methods in a given namespace (i.e.,
: 'MyNamespace.MySubNamespace')
: if specified more than once, acts as an AND operation
-noautoreporters : do not allow reporters to be auto-enabled by environment
: (for example, auto-detecting TeamCity or AppVeyor)
Reporters: (optional, choose only one)
-appveyor : forces AppVeyor CI mode (normally auto-detected)
-json : show progress messages in JSON format
-quiet : do not show progress messages
-teamcity : forces TeamCity mode (normally auto-detected)
-verbose : show verbose progress messages
-vsts : forces VSTS CI mode (normally auto-detected)
Result formats: (optional, choose one or more)
-xml <filename> : output results to xUnit.net v2 XML file
-xmlv1 <filename> : output results to xUnit.net v1 XML file
-html <filename> : output results to HTML file
-nunit <filename> : output results to NUnit v2.5 XML file
-junit <filename> : output results to JUnit XML file
是否有人有完整的命令行选项列表,用于从控制台进行 运行ning Xunit 测试?
我有大约 100 个测试,假设分成 10 个独立的 classes,每个 class 有 10 个测试
Class1 测试1 测试2 ...
Class2 测试1 测试2 ...
等等
我可以通过导航到我的测试目录并使用 'dotnet test' 来触发 运行 所有这些测试。 我发现文档说 -?显示所有命令行选项(但这显然不是完整列表)https://livebook.manning.com/book/dotnet-core-in-action/appendix-b/4
官方文档https://xunit.net/docs/running-tests-in-parallel 说我可以使用例如“-parallel all”但是当它 运行
dotnet 测试 - 全部并行
我明白了
\repos\test-automation-framework\framework>dotnet 测试 - 并行所有 MSBUILD:错误 MSB1001:未知开关。 开关:-parallel
对于开关语法,键入“MSBuild -help”
我想进入一个阶段,我可以 运行 我的所有测试并行,但将线程数限制为 6,所以我将 运行 我的整个测试套件,一次 6 个测试。
我是不是遗漏了一些非常明显的东西?
如果我没有正确理解你的问题,你想将一些命令行参数传递给 Xunit。但是当你 运行 dotnet test
它实际上将参数应用于 dotnet
命令。
您可以使用 configuration files 来启用并行化和其他功能。
xunit.config.json
{
"parallelizeAssembly": true
}
您提到的论点(例如 --parallel
)确实存在,但不在 dotnet
上下文中。您可以使用 console 运行ner 手动 运行 Xunit。它作为 xunit 存储库的一部分存在于 NuGet and on GitHub 中。
这是它的输出:
$ .\xunit.console.exe
xUnit.net Console Runner v2.4.1 (64-bit Desktop .NET 4.6.1, runtime: 4.0.30319.42000)
Copyright (C) .NET Foundation.
usage: xunit.console <assemblyFile> [configFile] [assemblyFile [configFile]...] [options] [reporter] [resultFormat filename [...]]
Note: Configuration files must end in .json (for JSON) or .config (for XML)
Valid options:
-nologo : do not show the copyright message
-nocolor : do not output results with colors
-failskips : convert skipped tests into failures
-stoponfail : stop on first test failure
-parallel option : set parallelization based on option
: none - turn off all parallelization
: collections - only parallelize collections
: assemblies - only parallelize assemblies
: all - parallelize assemblies & collections
-maxthreads count : maximum thread count for collection parallelization
: default - run with default (1 thread per CPU thread)
: unlimited - run with unbounded thread count
: (number) - limit task thread pool size to 'count'
-appdomains mode : choose an app domain mode
: ifavailable - choose based on library type
: required - force app domains on
: denied - force app domains off
-noshadow : do not shadow copy assemblies
-wait : wait for input after completion
-diagnostics : enable diagnostics messages for all test assemblies
-internaldiagnostics : enable internal diagnostics messages for all test assemblies
-debug : launch the debugger to debug the tests
-serialize : serialize all test cases (for diagnostic purposes only)
-trait "name=value" : only run tests with matching name/value traits
: if specified more than once, acts as an OR operation
-notrait "name=value" : do not run tests with matching name/value traits
: if specified more than once, acts as an AND operation
-method "name" : run a given test method (can be fully specified or use a wildcard;
: i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')
: if specified more than once, acts as an OR operation
-nomethod "name" : do not run a given test method (can be fully specified or use a wildcard;
: i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')
: if specified more than once, acts as an AND operation
-class "name" : run all methods in a given test class (should be fully
: specified; i.e., 'MyNamespace.MyClass')
: if specified more than once, acts as an OR operation
-noclass "name" : do not run any methods in a given test class (should be fully
: specified; i.e., 'MyNamespace.MyClass')
: if specified more than once, acts as an AND operation
-namespace "name" : run all methods in a given namespace (i.e.,
: 'MyNamespace.MySubNamespace')
: if specified more than once, acts as an OR operation
-nonamespace "name" : do not run any methods in a given namespace (i.e.,
: 'MyNamespace.MySubNamespace')
: if specified more than once, acts as an AND operation
-noautoreporters : do not allow reporters to be auto-enabled by environment
: (for example, auto-detecting TeamCity or AppVeyor)
Reporters: (optional, choose only one)
-appveyor : forces AppVeyor CI mode (normally auto-detected)
-json : show progress messages in JSON format
-quiet : do not show progress messages
-teamcity : forces TeamCity mode (normally auto-detected)
-verbose : show verbose progress messages
-vsts : forces VSTS CI mode (normally auto-detected)
Result formats: (optional, choose one or more)
-xml <filename> : output results to xUnit.net v2 XML file
-xmlv1 <filename> : output results to xUnit.net v1 XML file
-html <filename> : output results to HTML file
-nunit <filename> : output results to NUnit v2.5 XML file
-junit <filename> : output results to JUnit XML file