Usage
te.exe<test_binaries> [/appendWttLogging] [/breakOnCreate] [/breakOnError] [/breakOnInvoke] [/coloredConsoleOutput] [ /console:flushWrites] [/console:position=[x,y | current] [/console:size=<x,y>] [ /console:topmost ][/defaultAppDomain] [/disableConsoleLogging] [/disableTimeouts] [/dpiaware ] [/enableWttLogging] [/inproc] [/isolationLevel] [/labMode] [/list] [/listProperties] [/logFile:<name>] [/logOutput:<mode>] [/miniDumpOnCrash] [/miniDumpOnError] [/name:<testname>] [/outputFolder:<folderName>] [/p:<ParamName>=<ParamValue>] [/parallel] [/persistPictResults] [/pict:<OptionName>=<OptionValue>] [/rebootStateFile] [/reportLoadingIssue] [/runas:<RunAsType>] [/runIgnoredTests] [/runon:<MachineName>] [/screenCaptureOnError] [/select:<query>] [/sessionTimeout:<value>] [/stackFrameCount:<value>] [/stackTraceOnError] [/terminateOnFirstFailure] [/testDependencies:<files>] [/testmode:Loop] [/testmode:Stress] [/testTimeout:<value>] [/unicodeOutput:<true/false>] [/version] [/wttDeviceString:<value>] [/wttDeviceStringSuffix:<value>]
Selection/Execution Commands
test_binaries
指定要执行的一个或多个测试文件(用空格分隔)。 支持通配符。
te.exe test1.dll
Interpretation: Run all tests in test1.dll.
te.exe test1.dll test2.dll test3.dll
Interpretation: Run all tests in test1.dll, test2.dll and test3.dll.
te.exe *.dll
Interpretation: Run all tests in all dlls in the current directory.
/coloredConsoleOutput:<true/false>
指定 TAEF 是否应输出彩色控制台文本。 默认值为 true。 如果设置为 false,TAEF 将使用默认控制台颜色输出所有文本。
te.exe test1.dll /coloredConsoleOutput:false
/console:<optionName>=<value>
提供用于配置 TE 使用控制台的选项。 可以使用以下选项:
/console:flushWrites
使控制台输出在写入每行后刷新 - 当 TE.exe的输出已重定向时非常有用。
/console:position=[x,y | current ]
设置主机窗口相对于主监视器角的位置(以像素为单位)。 Use a value of current to specify that the current console position should be stored and used when resuming from reboot.
/console:size=[ <x,y> | current ]
设置控制台窗口的大小(以字符维度为单位)。 屏幕缓冲区大小将增加,以匹配窗口的大小(如有必要)。 Use a value of current to specify that the current console size should be stored and used when resuming from reboot.
/console:topmost
在执行期间,使控制台在桌面 z 顺序中保持运行 te.exe“最顶层”。
/dpiaware
Executes tests in a process marked as DPI-aware, see High DPI. 也可以通过元数据(“DpiAware”)来设置此设置。
/inproc
在 TE.exe 进程本身而不是 TE.ProcessHost.exe内执行所有测试。
te.exe test1.dll /inproc
Note
TE only supports executing one test dll at a time when using the /inproc setting.
/isolationLevel:<Level>
指定执行 TAEF 测试时要使用的最小隔离级别。 如果此值与指定为元数据的 IsolationLevel 冲突,则该值将成为最紧密范围的隔离级别。 See Test Isolation for more details.
te.exe test1.dll /isolationLevel:Class
/labMode
执行测试并删除潜在的阻止 UI(例如,崩溃测试上的 Windows 错误报告对话框)。
/list
Lists the names of all the test_binaries and the classes and methods within them. 如果指定了选择条件,则仅列出满足条件的那些名称。
te.exe test1.dll test2.dll /list
WEX::UnitTests::Test1
WEX::UnitTests::Test1::Example1
WEX::UnitTests::Test1::Example2
WEX::UnitTests::Test1::Example3
WEX::UnitTests::Test2
WEX::UnitTests::Test2::Example1
WEX::UnitTests::Test2::Example2
WEX::UnitTests::Test2::Example3
te.exe test1.dll test2.dll /select:@name='*Example2*' /list
WEX::UnitTests::Test1
WEX::UnitTests::Test1::Example2
WEX: :UnitTests::Test2
WEX::UnitTests::Test2::Example2
/listProperties
列出所有test_binaries的名称和属性以及其中的类和方法以及 Setup 和 Teardown 函数名称(如果可用)。 如果指定了选择条件,则仅列出满足条件的那些名称。
te.exe test1.dll test2.dll /listProperties
WEX::UnitTests::Test1
WEX::UnitTests::Test1::Example1
Setup: Test1Setup
Teardown: Test1Teardown
Property[ThreadingModel] = MTA
WEX::UnitTests::Test1::Example2
Setup: Test1Setup
Teardown: Test1Teardown
Property[ThreadingModel] = STA
WEX::UnitTests::Test1::Example3
Setup: Test1Setup
Teardown: Test1Teardown
Property[ThreadingModel] = STA
WEX::UnitTests::Test2
WEX::UnitTests::Test2::Example1
Property[ThreadingModel] = MTA
WEX::UnitTests::Test2::Example2
Property[ThreadingModel] = STA
WEX::UnitTests::Test2::Example3
Property[ThreadingModel] = MTA
te.exe test1.dll test2.dll /select:@name='*Example2*' /listProperties
WEX::UnitTests::Test1
WEX::UnitTests::Test1::Example2
Setup: Test1Setup
Teardown: Test1Teardown
Property[ThreadingModel] = STA
WEX::UnitTests::Test2
WEX::UnitTests::Test2::Example2
Property[ThreadingModel] = STA
/name:<testname>
基于测试名称的选择是“/select:@Name='<testname>'”的简单替代方法。 testname <> 仍可以包含通配符(“*”和“?”),但不应包含在单引号中。 如果在命令提示符下指定了 /select 和 /name,则 /select 查询优先且忽略 /name。
te.exe test1.dll /name:*TestToLower
Interpretation: Run all tests in test1.dll where method names end with 'TestToLower'. 可以使用选择条件作为 /select:@Name='*TestToLower'来表示这一点。
te.exe test1.dll /name:*StringTest*
Interpretation: Run all tests in test1.dll which contain the phrase 'StringTest' in their namespace, class or method name.
/outputFolder:<folderName>
指定要放置所有生成的文件的文件夹。 默认为当前目录。 可以使用环境变量,例如:
te.exe test1.dll /outputFolder:%TEMP%\\MyOutput
/p:<ParamName>=<ParamValue>
使用参数名称=ParamName 和参数值=ParamValue 定义运行时参数。 可以从测试方法或设置/清理方法访问这些参数。
te.exe test1.dll /p:x=5 /p:myParm=cool
可以在测试代码中将 x 捕获为多个受支持的类型之一。 例如,在这里可以看到我们将其检索为 int 和 WEX::Common::String:
int x = 0;
String xString;
RuntimeParameters::TryGetValue(L"x", x);
RuntimeParameters::TryGetValue(L"x", xString);
For more information, please visit the TAEF.Runtime Parameters help page.
/parallel
跨多个处理器并行执行测试。 测试必须选择加入并行执行,方法是使用“并行”元数据进行标记。
te.exe test1.dll /parallel
For more information, please visit the Parallel help page.
/persistPictResults
Caches results generated by PICT.exe for tests using PICT DataSource in the current execution. 后续的测试执行将尝试将缓存结果与针对同一模型和种子文件运行 PICT.exe 一样。
/pict:<OptionName>=<OptionValue>
Provides options for controlling PICT.exe when it is called for tests using a PICT DataSource. 设置其中一个选项当前会替代代码中的所有关联元数据。 可以使用以下选项:
/Pict:Order=3
通过 /o 命令选项传递 PICT.exe的值来设置组合顺序。
/Pict:ValueSeparator=;
通过 PICT.exe的 /d 命令选项传递值来设置值分隔符。
/Pict:AliasSeparator=+
通过 PICT.exe的 /a 命令选项传递值来设置别名分隔符。
Pict:NegativeValuePrefix=!
通过 PICT.exe的 /n 命令选项传递值来设置负值前缀。
/Pict:SeedingFile=test.seed
通过用于 PICT.exe的 /e 命令选项传递值来设置种子设定文件的路径。
/Pict:Random=true
打开或关闭 PICT 结果中的随机性,并使 PICT 数据源记录使用的随机种子。
/Pict:RandomSeed=33
通过用于 PICT.exe的 /r 命令选项传递值来设置随机种子。 此设置将打开 Pict:Random,除非 Pict:Random 显式设置为 false。
/Pict:CaseSensitive=true
设置为 true 时,通过将 /c 命令选项传递给 PICT.exe来启用区分大小写。
/Pict:Timeout=00:01:30
设置在终止进程之前等待 PICT.exe 完成的时间。 该值的格式为 [Day.]Hour[:Minute[:Second[.FractionalSeconds]]]。
/runas:<RunAsType>
在指定的环境中执行测试。 Please refer to the RunAs documentation for detailed usage information.
te.exe *.dll /runas:System
Interpretation: Run all tests as System.
te.exe *.dll /runas:Elevated
Interpretation: Run all tests as an elevated user.
te.exe *.dll /runas:Restricted
Interpretation: Run all tests as a non-elevated user.
te.exe *.dll /runas:LowIL
Interpretation: Run all tests in a Low Integrity process.
/runIgnoredTests
Executes or lists (if in conjunction with /list or /listProperties) all tests, including test classes and test methods with "Ignore" metadata set to "true". 默认情况下,在执行期间和列出期间会跳过“Ignore”元数据设置为“true”的测试类和测试方法。
/runon:<MachineName>
在指定的计算机上远程执行测试。 TAEF 对执行测试所需的二进制文件进行身份验证、授权和部署,并将所有信息记录回原始控制台。 有关详细使用情况信息,请参阅 “跨计算机测试执行 ”文档。
te.exe *.dll /runon:TestMachine1
Interpretation: Run all tests remotely on "TestMachine1".
/select:<query>
从每个测试二进制文件选择测试时要使用的选择条件。 选择条件由以下一个或多个组成:
@[属性名称] = [值作为字符串]
@[属性名称] >= [value as float or integer]
@[属性名称] > [value as float or integer]
@[属性名称] <= [value as float or integer]
@[属性名称] < [value as float or integer]
- 作为字符串的属性值必须位于单引号内。
- 可以使用“and”、“or”和“not”(不区分大小写)指定复合选择条件。
- 属性值通过“*”和“?”字符支持通配符。
- 对于浮点值和整数值,“*”字符也可用作“exists”,但不能用于部分匹配。 For example: /select:"@Priority=*" is valid, but /select:"@Priority=4*" is not.
te.exe test1.dll /select:“(@Name='*TestToLower'或 @Owner='C2'),而不是(@Priority < 3)”
Interpretation: Run all tests in test1.dll where method names end with 'TestToLower' or where owner is 'C2'; and where Priority is not less than 3.
te.exe test1.dll test2.dll /select:@Priority=\*
Interpretation: Run all tests in test1.dll and test2.dll where the Priority has been specified in their test metadata.
te.exe test1.dll /select:@Name='*StringTest*'
Interpretation: Run all tests in test1.dll which contain the phrase 'StringTest' in their namespace, class or method name.
/sessionTimeout:<value>
为 Te.exe的整个执行设置会话超时。 如果超时过期,测试会话将正常中止,进程退出代码表示发生超时。
Note
超时值必须采用以下格式指定:
[Day.]Hour[:Minute[:Second[.FractionalSeconds]]]
Note
如果在 WTT 下运行,则此值可用于确保 Wtt 日志文件保持不变,即使 TAEF 会话超时也是如此。
te.exe test1.dll /sessionTimeout:0:0:0.5
整个测试会话将在 .5 秒后超时。
te.exe test1.dll /sessionTimeout:0:0:45
整个测试会话将在 45 秒后超时。
te.exe test1.dll /sessionTimeout:0:20
整个测试会话将在 20 分钟后超时。
te.exe test1.dll /sessionTimeout:5
整个测试会话将在 5 小时后超时。
te.exe test1.dll /sessionTimeout:1.2
整个测试会话将在 1 天 2 小时后超时。
/terminateOnFirstFailure
首次遇到测试失败时终止测试运行。 将调用该测试的所有拆解作,但所有后续测试都标记为忽略。 由于已知问题,使用测试模式时,测试可能会继续运行。
te.exe test1.dll /terminateOnFirstFailure
/testDependencies:<files>
指定在使用 跨计算机测试执行时要部署的其他测试依赖项。 除非提供完整路径,否则 TAEF 将相对于当前目录(而不是测试目录)进行搜索。
te.exe *.dll /runon:TestMachine1 /TestDependencies:test*.jpg;file1.doc
Interpretation: Run all tests remotely on "TestMachine1", and copy 'test*.jpg' and 'file1.doc' over to the remote machine before executing any tests. 每个文件规范可以包含通配符(test.txt;test*.dll; 等),以匹配一个或多个文件。
/testTimeout:<value>
为 Te.exe的整个执行设置全局测试超时。 This value overrides any test time-out metadata that may have been set for a given test being executed.
Note
超时值必须采用以下格式指定:
[Day.]Hour[:Minute[:Second[.FractionalSeconds]]]
Note
Will be ignored when used in conjunction with /inproc.
te.exe test1.dll /testTimeout:0:0:0.5
每个测试和设置/清理方法将在 .5 秒后超时。
te.exe test1.dll /testTimeout:0:0:45
每个测试和设置/清理方法将在 45 秒后超时。
te.exe test1.dll /testTimeout:0:20
每个测试和设置/清理方法将在 20 分钟后超时。
te.exe test1.dll /testTimeout:5
每个测试和设置/清理方法将在 5 小时后超时。
te.exe test1.dll /testTimeout:1.2
每个测试和设置/清理方法将在 1 天和 2 小时后超时。
/unicodeOutput:<true/false>
当 TE 通过管道传递给文本文件时,它默认输出 unicode。 其中一个例外是,如果请求追加到现有 ANSII 文件(通过“'>>)。
若要重写此行为,可以指定 /unicodeOutput:false。 这将强制 TE 始终将 ANSII 输出到该文件。
te.exe test1.dll /unicodeOutput:false > output.txt
Logger Settings
/appendWttLogging
启用 WTT 日志记录后,将追加到日志文件,而不是覆盖它。 Must be used in conjunction with /enableWttLogging.
te.exe test1.dll /enableWttLogging /appendWttLogging
Will create, or append to a log file called TE.wtl upon test execution completion.
/enableWttLogging
启用 WTT 日志记录;Wttlog.dll 必须在路径中可用。
te.exe test1.dll /enableWttLogging
Will produce a log file called TE.wtl upon test execution completion.
/defaultAppDomain
在默认应用程序域中执行托管测试。
te.exe managed.test1.dll /defaultAppDomain
/disableConsoleLogging
Disables console log output; must be used in conjunction with /enableWttLogging.
te.exe test1.dll /disableConsoleLogging /enableWttLogging
/logFile:<name>
Specify a name to use as the wtt log file; must be used in conjunction with /enableWttLogging.
te.exe test1.dll /logFile:myCustomLogFile.xml /enableWttLogging
Will produce a log file called myCustomeLogFile.xml upon test execution completion.
/logOutput:<mode>
设置记录器输出级别。 有效值为:
- High: Enables some additional console output such as printing a time stamp next to every trace.
- Low: Emits only core events (start, end group, etc) and errors. 日志文件包括优先级较低的详细信息,预先提供任何错误来提供故障上下文。
- LowWithConsoleBuffering: Same as Low, but includes the context of failures in both the log file and console output.
- Lowest: Same as Low, but console output includes only errors, test failures, and the summary of execution.
/version
输出详细的版本信息。
/wttDeviceString:<value>
完全替代 WexLogger 初始化 WttLogger 时使用的 WttDeviceString。
te.exe test1.dll /wttDeviceString:$Console
/wttDeviceStringSuffix:<value>
在初始化 WttLogger 时,将指定的值追加到 WexLogger 使用的默认 WttDeviceString。 Ignored if wttDeviceString is also specified.
te.exe test1.dll /wttDeviceStringSuffix:$Console
Debug Settings
/breakOnCreate
在实例化每个测试类之前中断调试器。
te.exe test1.dll /breakOnCreate
/breakOnError
如果记录错误或测试失败,则会中断调试器。
te.exe test1.dll /breakOnError
/breakOnInvoke
在调用每个测试方法之前中断调试器。
te.exe test1.dll /breakOnInvoke
/disableTimeouts
禁用执行期间的所有超时。 当 TAEF 正在等待正在调试的程序的一部分时,调试时,这非常有用,以防止超时。
te.exe test1.dll /disableTimeouts
/miniDumpOnError
如果发生测试错误或失败,则获取并记录小型转储。
te.exe test1.dll /miniDumpOnError
/miniDumpOnCrash
如果发生测试崩溃,则获取并记录一个小型转储。
te.exe test1.dll /miniDumpOnCrash
/rebootStateFile
Explicitly enables execution of Reboot tests.
te.exe test1.dll /rebootStateFile:myFile.xml
/reportLoadingIssue
当 TAEF 无法加载测试 dll 时显示错误说明对话框。 只能用于调查本机测试 dll 加载问题。
te.exe test1.dll /reportLoadingIssue
/screenCaptureOnError
如果发生测试错误或失败,则获取并记录屏幕捕获。
te.exe test1.dll /screenCaptureOnError
/stackFrameCount:<value>
指定要在获取调用堆栈时显示的堆栈帧数。 默认值为 50。
te.exe test1.dll /stackFrameCount:100
/stackTraceOnError
如果发生测试错误或失败,则获取并记录堆栈跟踪。
te.exe test1.dll /stackTraceOnError
Test Modes
/testmode:Loop
Allows controlling the execution using two variables Loop and LoopTest.
- Loop: Controls how many times the whole run is executed. Default 1.
- LoopTest: Controls how many times an individual test is executed. Default 10.
te.exe test1.dll /testmode:Loop
Interpretation: Run every test in test1.dll 10 times (default value for LoopTest). The whole execution is run once (default value for Loop).
te.exe test1.dll test2.dll /testmode:Loop /Loop:3 /LoopTest:1
Interpretation: Run every test in test1.dll and test2.dll once (determined by LoopTest). The whole execution (all combined tests in test1.dll and test2.dll) is run 3 times - as determined by Loop.
/testmode:Stress
在“压力”测试模式下,TAEF 将无限期运行测试,直到输入 Ctrl+C,或直到将WM_CLOSE消息发送到 TAEF 的隐藏窗口为止。 /testmode:stress must be run in conjunction with /inproc.
te.exe test1.dll /testmode:Stress /inproc
For detailed information and other parameters supported in this mode, see Test Modes.