处理来自结果报告程序的日志文件
在某些情况下,只能访问测试结果还不够,必须具有日志文件才能让总体结果变得完整。
日志接口
任何结果报告程序或测试事件均可通过实现 ILogSaverListener 来访问日志,该接口允许报告程序通过不同的回调来接收日志:
testLogSaved
:在记录了文件时立即调用。这会通知记录了新文件。随时都会调用此事件。
logAssociation
:按测试事件的顺序调用。这可确保正在记录的文件与正在进行的事件之间存在很强的关联。
通过实现此接口,结果报告程序可以访问并使用所记录文件的引用。
何时使用 logAssociation
logAssociation
是一个稍微有些复杂的事件,因为它依赖于事件的上下文才能得到正确解释。例如,如果调用了 testStart
,那么来自 logAssociation
的日志将归属于正在进行的测试用例。
利用这种强大的关联,可以正确放置日志。
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2021-03-09 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]