简体   繁体   English

将单元测试结果/报告写入文本文件和控制台的最佳做法或模式

[英]Best practices or patterns for writing unit test results/reports to text file as well as to console

We have our own unit test framework for blackberry application. 我们有自己的用于Blackberry应用程序的单元测试框架。 And now we need to generate unit test report in text file, before we were just printing on console. 现在,我们只需要在控制台上打印,就需要在文本文件中生成单元测试报告。

CommandController.java - Sends commands to blackberry simulator and receive response in string format. CommandController.java-将命令发送到Blackberry模拟器并以字符串格式接收响应。 It displays which commands has sent to simulator and responses on console 它显示哪些命令已发送到模拟器以及控制台上的响应

TestResults.java - compares the string response received above with expected value and prints success or failure info. TestResults.java-将上面收到的字符串响应与期望值进行比较,并显示成功或失败信息。

CommandController.java and TestResults.java are invoked from main class SimmTest.java. 从主类SimmTest.java调用CommandController.java和TestResults.java。

Now I want to capture the info from both CommandController.java and TestResult.java in text file and as well as display on console. 现在,我想从CommandController.java和TestResult.java中捕获文本文件中的信息,并在控制台上显示它们。

Please let me know the best practices or patterns for this scenario. 请让我知道此方案的最佳做法或模式。 Thanks for help! 感谢帮助!

I don't know about java and blackberry but a format I like to display tests results is "TAP" 我不了解Java和Blackberry,但我想显示测试结果的格式是“ TAP”

http://en.wikipedia.org/wiki/Test_Anything_Protocol http://en.wikipedia.org/wiki/Test_Anything_Protocol

Basically the output of the tests is something like that : 基本上,测试的输出是这样的:

  1..12
  ok 1 - This is the title of the first test
  not ok 2 - This is the title of the second test

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

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