找回密码
 注册
查看: 365|回复: 0

R语言 RUnit包 textProtocol()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-28 23:42:18 | 显示全部楼层 |阅读模式
textProtocol(RUnit)
textProtocol()所属R语言包:RUnit

                                        Printing a plain text or HTML version of an RUnit test run protocol.
                                         打印纯文本或HTML版本的的鲁尼特试运行协议。

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

printTextProtocol prints a plain text protocol of a test run. The resulting test protocol can be configured through the function arguments.
printTextProtocol打印一个纯文本协议的测试运行。产生的测试协议可以通过配置的功能参数。

printHTMLProtocol prints an HTML protocol of a test run. For long outputs this version of the test protocol is slightly more readable than the plain text version due to links in the document. The resulting test protocol can be configured through the function arguments.
printHTMLProtocol打印的HTML协议的试运行。对于较长的输出,这个版本的测试协议是更具可读性比纯文字版本,由于文档中的链接。函数的参数可以通过配置产生的测试协议。

print prints the number of executed test functions and the number of failures and errors.
print打印执行的功能测试和故障和错误的数目的数目。

summary directly delegates the work to printTextProtocol.
summary直接代表的工作printTextProtocol。

getErrors returns a list containing the number of test functions, the number of deactivated functions (if there are any), the number of errors and the number of failures.
getErrors返回的列表中包含的数目的测试功能,停用的功能(如果有的话)的数目,错误和失败的次数的数目。


用法----------Usage----------


  printTextProtocol(testData, fileName = "",
                    separateFailureList = TRUE,
                    showDetails = TRUE, traceBackCutOff = 9)
  printHTMLProtocol(testData, fileName = "",
                    separateFailureList = TRUE,
                    traceBackCutOff = 9,
                    testFileToLinkMap = function(x) x )
  print.RUnitTestData(x, ...)
  summary.RUnitTestData(object, ...)
  getErrors(testData)



参数----------Arguments----------

参数:testData, x, object
objects of class RUnitTestData, typically obtained  as return value of a test run.
类RUnitTestData的对象,通常作为返回值的测试运行。


参数:fileName
Connection where to print the text protocol (printing is done by the cat command).
连接打印文本协议(印刷是通过cat命令)。


参数:separateFailureList
If TRUE a separate list of failures and errors is produced at the top of the protocol. Otherwise, the failures and errors are only listed in the details section.
如果TRUE的故障和错误的是,一个单独的列表的顶部产生的协议。否则,失败和错误是只在细节部分上市。


参数:showDetails
If TRUE the protocol contains a detailed listing of all executed test functions.
如果TRUE协议包含所有已执行的测试功能的详细列表。


参数:traceBackCutOff
The details section of the test protocol contains the call stack for all errors. The first few entries of the complete stack typically contain the internal RUnit function calls that execute the test cases and are irrelevant for debugging. This argument specifies how many calls are removed from the stack before it is written to the protocol. The default value is chosen such that all uninteresting RUnit calls are removed from the stack if runTestSuite has been called from the console. This argument takes effect only if showDetails=TRUE.
细节部分的测试协议中包含的所有错误的调用堆栈。前几个项目的完整的堆栈通常包含内部鲁尼特功能,执行测试用例,并进行调试无关的呼叫。此参数指定从堆栈中取出多少检测之前,书面的协议。选择默认值是所有无趣的鲁尼特调用runTestSuite从控制台被称为从堆栈中删除。此参数生效只有showDetails=TRUE。


参数:testFileToLinkMap
This function can be used to map the full name of the test file to a corresponding html link to be used in the html protocol. By default,  this is the identity map. See example below.
此功能可用于测试文件的全名映射到相应的HTML链接中要使用的HTML协议。默认情况下,这是身份的图。见下面的例子。


参数:...
additional arguments to summary are passed on to the printTextProtocol() call.
总结额外的参数传递给printTextProtocol()调用。


Details

详细信息----------Details----------

The text protocol can roughly be divided into three sections with an increasing amount of information. The first section as an overview just reports the number of executed test functions and the number of failures and errors. The second section describes all test suites. Optionally, all errors and failures that occurred in some test suite are listed. In the optional third section details are given about all executed test functions in the order they were processed. For each test file all test functions executed are listed in the order they were executed. After the test function name the number of check<*> function calls inside the test case and the execution time in seconds are stated. In the case of an error or failure as much debug information as possible is provided.
文本协议可以粗略地分为三个部分,与增加量的信息。第一部分的概述报告的数量和执行测试功能的失败和错误。第二部分介绍了所有的测试套件。或者,列出所有的错误和失败,发生在一些测试套件。在可选的第三部分的细节处理它们的顺序执行所有的测试功能。对于每一个测试文件中的所有测试功能执行中列出的顺序执行。测试函数名后check<*>内部的函数调用测试用例,执行时间,以秒表示。在的错误或故障的情况下,提供尽可能多的调试信息。


(作者)----------Author(s)----------


Thomas K枚nig, Klaus J眉nemann
&amp; Matthias Burger



参见----------See Also----------

runTestSuite
runTestSuite


实例----------Examples----------



## run some test suite[#运行一些测试套件]
myTestSuite <- defineTestSuite("RUnit Example",
                               system.file("examples", package = "RUnit"),
                               testFileRegexp = "correctTestCase.r")
testResult <- runTestSuite(myTestSuite)


## prints detailed text protocol[#打印出详细的文本协议]
## to standard out:[#输出到标准输出:]
printTextProtocol(testResult, showDetails = TRUE)
## prints detailed html protocol[#打印出详细的HTML协议]
## to standard out[#输出到标准输出]
printHTMLProtocol(testResult)


## Not run: [#不运行:]
##  example function to add links to URL of the code files in a code[#示例将链接添加到URL的代码文件的功能代码]
##  repository, here the SourceForge repository[#库中,在SourceForge资源库]
testFileToSFLinkMap <- function(testFileName, testDir = "tests") {
    ##  get unit test file name[#单元测试文件名]
    bname <- basename(testFileName)
   
    ## figure out package name[#包名]
    regExp <- paste("^.*/([\.a-zA-Z0-9]*)/", testDir,"/.*$", sep = "")
    pack <- sub(regExp, "\1", testFileName)
    return(paste("http://runit.cvs.sourceforge.net/runit/",
                 pack, testDir, bname, sep = "/"))
  }


##  example call for a test suite run on the RUnit package[#例如呼叫测试套件,上运行的鲁尼特包的]
testSuite <- defineTestSuite("RUnit", "<path-to-source-folder>/RUnit/tests",
                             testFileRegexp = "^test.+")
testResult <- runTestSuite(testSuite)
printHTMLProtocol(testResult, fileName = "RUnit-unit-test-log.html",
                  testFileToLinkMap = testFileToSFLinkMap )

## End(Not run)[#(不执行)]


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-28 06:39 , Processed in 0.019551 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表