黑盒回归测试的测试框架

发布于 2024-07-04 04:39:40 字数 334 浏览 6 评论 0原文

我正在寻找一种工具来对我们正在建造的一套设备进行回归测试。

当前的概念是为工具创建一个输入文件 (text/csv),指定被测系统的输入。 然后,该工具捕获系统的输出并将输入和输出记录到输出文件中。

输出与原始输入文件的格式相同,可用作该工具后续运行的输入,测量的输出与上次运行的值相匹配。

两次运行的结果不会完全匹配,存在一些时间差异,这取决于电池的状态,或者取决于设备的其他内部状态。

我们必须编写自己的接口,将命令从工具传递到设备并捕获设备的输出。

这是一个相对简单的任务,但我正在寻找一个现有的工具/包/库,以避免重新发明轮子/从中吸取教训。

I am looking for a tool for regression testing a suite of equipment we are building.

The current concept is that you create an input file (text/csv) to the tool specifying inputs to the system under test. The tool then captures the outputs from the system and records the inputs and outputs to an output file.

The output is in the same format as the original input file and can be used as an input for following runs of the tool, with the measured outputs matched with the values from the previous run.

The results of two runs will not be exact matches, there are some timing differences that depend on the state of the battery, or which depend on other internal state of the equipment.

We would have to write our own interfaces to pass the commands from the tool to the equipment and to capture the output of the equipment.

This is a relatively simple task, but I am looking for an existing tool / package / library to avoid re-inventing the wheel / steal lessons from.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

糖果控 2024-07-11 04:39:40

我最近在 git 之上构建了一个这样的系统 (http://git.or.cz/) 。 基本上,编写一个程序来获取所有输入文件,将它们发送到服务器,读回输出,并将其写入一组输出文件。 第一次运行后,将输出文件提交到 git。

对于未来的运行,您的成功取决于运行完成后 git 存储库是否干净:

test 0 == $(git diff data/output/ | wc -l)

作为奖励,您可以使用所有 git 工具来比较差异,如果发现差异是一种改进,则提交它们,这样未来的运行将会过去。 在分支之间合并时它也非常有效。

I recently built a system like this on top of git (http://git.or.cz/). Basically, write a program that takes all your input files, sends them to the server, reads the output back, and writes it to a set of output files. After the first run, commit the output files to git.

For future runs, your success is determined by whether the git repository is clean after the run finishes:

test 0 == $(git diff data/output/ | wc -l)

As a bonus, you can use all the git tools to compare differences, and commit them if it turns out the differences were an improvement, so that future runs will pass. It also works great when merging between branches.

深陷 2024-07-11 04:39:40

我不确定是否有一个软件包完全适合您的需求。 您需要考虑以下几点:

  1. 如何将数据传递到设备以及如何将数据收集回来。 这是非常特定于应用程序的,但通常不错的选择是老式串行端口 (RS232),对于任何编程语言都存在简单的接口。
  2. 如何运行测试。 单元测试框架绝对可以在这方面为您提供帮助。 现有框架实现了许多基本功能 - 选择要运行的测试、选择报告的详细级别(对于首先的详细调试和稍后的生产阶段通过/失败分析非常重要)。 我在使用 Perl 和 Python 测试框架测试嵌入式设备方面拥有丰富的经验。
  3. 您还必须决定如何进行比较。 正如您正确指出的那样,结果不会相等。 这就是您的领域知识发挥作用的地方。通常,它只是使用适用于您的领域的误差范围来实现。 当然,您将无法使用基本的 diff 工具,并且必须编写智能脚本。

I'm not sure there will be a single package that exactly suits your needs. You have a few considerations to make:

  1. How to pass data to the equipment and how to collect it back. This is very application specific, but a usually good option is the old'n'good serial port (RS232) for which an easy interfact exists for any programming language.
  2. How to run the tests. A unit-testing framework can definitely help you here. The existing frameworks have a lot of the basic features implemented - selecting tests to run, selecting the detail-level of the report (very important for detailed debugging at first and production-stage PASS/FAIL analysis later on). I've had good experience using the test frameworks of both Perl and Python from testing embedded devices.
  3. You also have to decide how to make the comparisons. As you correctly noted, the results won't be equal. This is where your domain knowledge comes in. Usually, it is simply implemented using error margins that are applicable in your domain. Of course, you won't be able to use a basic diff tool and will have to write an intelligent script.
世界如花海般美丽 2024-07-11 04:39:40

您可以使用任何测试框架。 困难的部分是编写工具来从测试系统发送/检索数据,而不是实际的字符串比较。

您的测试将如下所示:

x = read_input_file(ifilename);
y1 = read_expected_data(ofilename);
send_input_file_to_server();
y2 = read_output_from_server();
checkequal(y1, y2)

You can just use any test framework. The hard part is writing the tools to send/retrieve the data from your test system, not the actual string comparisons.

Your tests would just all look like this:

x = read_input_file(ifilename);
y1 = read_expected_data(ofilename);
send_input_file_to_server();
y2 = read_output_from_server();
checkequal(y1, y2)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文