简体   繁体   English

DunitX,如何只运行一个测试?

[英]DunitX, how to run only one test?

Everytime I run my DUnitX project, it's ran all tests.每次我运行我的 DUnitX 项目时,它都会运行所有测试。 Is their a simple way to make it run only one test (The test I m working on for example)?他们是让它只运行一个测试的简单方法吗(例如我正在做的测试)? Is it possible specify the test to run in the command line?是否可以指定要在命令行中运行的测试?

I haven't used the options yet but it appears that it has command line options to run one test or multiple tests, or use a file to hold the tests to run.我还没有使用这些选项,但它似乎有命令行选项来运行一个或多个测试,或者使用一个文件来保存要运行的测试。

All available options:所有可用选项:

--options:value or -opt:value - Options File --options:value 或 -opt:value - 选项文件

--hidebanner or -b - Hide the License Banner --hidebanner 或 -b - 隐藏许可证横幅

--xmlfile:value or -xml:value - XML output file path --xmlfile:value 或 -xml:value - XML output 文件路径

--runlist:value or -rl:value - Specify the name of a file which lists the tests to run --runlist:value 或 -rl:value - 指定列出要运行的测试的文件的名称

--run:value or -r:value - Specify the tests to run, separate by commas --run:value 或 -r:value - 指定要运行的测试,用逗号分隔

--include:value or -i:value - Specify the categories to include --include:value 或 -i:value - 指定要包含的类别

--exclude:value or -e:value - Specify the categories to exclude --exclude:value 或 -e:value - 指定要排除的类别

--dontshowignored or -dsi - Don't show ignored tests --dontshowignored 或 -dsi - 不显示忽略的测试

--loglevel:value or -l:value - Logging Level - Information, Warning, Error --loglevel:value 或 -l:value - 日志记录级别 - 信息、警告、错误

--exitbehavior:value or -exit:value - Exit behavior - Continue, Pause --exitbehavior:value 或 -exit:value - 退出行为 - 继续、暂停

--h or -? --h 还是-? - Show Usage - 显示用法

DUnitX command line options DUnitX 命令行选项

To the first part of your question:对于您问题的第一部分:

Is their a simple way to make it run only one test他们是让它只运行一个测试的简单方法吗

DUnitX will skip private methods. DUnitX 将跳过私有方法。 So just add a private label (ie section) on top of all your tests, and leave the one you want to test in a public/published section.因此,只需在所有测试之上添加一个private label(即部分),然后将要测试的部分留在公共/已发布部分中。

When you're done, remove the private label.完成后,删除私有 label。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM