用于在 Python 中测试嵌入式系统的测试框架 [英] Test framework for testing embedded systems in Python

查看:87
本文介绍了用于在 Python 中测试嵌入式系统的测试框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试嵌入式设备的功能.为简化起见,我可以说它是一个由 PC 通过 C/C++ API 远程控制的人形机器人.

I would like to test the features of an embedded device. To simplify I can say it is an humanoid robot remotely controlled by a PC through a C/C++ API.

我对使用 nosetests 非常感兴趣,因为它的非样板方法.但是,我的情况有点复杂.实际测试在 C# 程序上运行,大约需要 24 小时才能完成.通过切换到 Python,我可能会节省大量开发新测试的时间.但是,在这样做之前,我正在寻找一些答案.

I am very interested to use nosetests because of its non-boilerplate approach. However, my case is a bit more complicated. The actual test is running on a C# program and takes about 24h to complete. By switching to Python, I might save a lot of time developing new tests. But, before doing this, I am looking for some answers.

古老的测试套件的第一个问题是所有测试都按照预定义的顺序执行,如果出现任何错误,整个测试就会停止.我想构建不依赖于其他测试结果的独立测试套件.例如,与机器人手臂相关的测试与其中一条腿无关.但是,步行测试需要两者都成功.

The first problem of the ancient test suite is that all tests are executing in a predefined order and if any error occur, the whole test stops. I would like to build independent test suites that does not depend on other tests results. For example, the test related to the arm of the robot has no relation with the one of the legs. However, the walk test needs both to be successful.

在晚上执行所有测试套件.如果一个失败,则执行下一个,依此类推.优点是在周一早上你回来工作时,你可以获得更多有用的结果,而不是在周五晚上你离开 10 分钟后整个测试已经失败.

At night all test-suites are executed. If one fail, the next is executed and so on. The advantage is that on the Monday Morning when you come back to work, you can have more useful results than if the whole tests had already failed on Friday night 10 minutes after you left.

我是否正在寻找一个允许:

So am I looking for a test framework that allows:

  • 在测试套件中拆分测试.
  • 尝试每个测试套件,无论前一个测试套件是否失败.
  • 提供有关某些测试依赖项的信息.

我查看了允许依赖项装置的 Proboscis,但该项目看起来已经死了.

I looked at Proboscis that allows dependencies fixtures, but the project look dead.

我想知道定制鼻子需要多少工作才能获得这些功能.也许还值得尝试另一个测试框架.我不知道,我需要一些线索...

I am wondering how much work would it take to customize nose in order to get these features. Perhaps it worth also trying another test framework. I don't know and I need some clues...

因此,为了使事情尽可能简单,以下是我对测试的看法:

So, in order to keep things as simple as possible, here's how I see my tests:

#!/usr/bin/python

def testArms():
   ...
   pass

def testLegs():
   ...
   pass

@depend(testArms, testLegs)
def testWalk():
   ...
   pass

test_suite1 = [testLegs, testArms, testWalk]

...

推荐答案

很久没有问这个问题了.

Long time since this question was asked.

嵌入式系统具有实现验收测试自动化的特殊特征(最重要的一个是,被测设备"很可能与执行测试用例的设备不同;因此具有相同类型的交互界面是必须的).在对网页或 PC 应用程序进行测试自动化时,甚至在运行嵌入式软件(也可以在设备外部执行)的单元测试时,情况并非完全正确".基于这个假设,我认为为进行单元测试而开发的框架并不是开发用于执行验收测试的嵌入式系统测试平台的最佳工具.

Embedded Systems present special characterists to implement acceptance testing automation (one of the most important is that, most likely, the "Device Under Test" is not the same device as the one executing the test cases; hence same kind of interaction interface is required). This is not "excatly" the case when doing test automation of a Web Page or a PC Application or even when running unit testing of an embedded software (which can also be executed outside of the device). Based on this assumption, I think a framework which is developed for doing unit testing is not the best tool to develop an Emedded System Test Bench for performing acceptance tests.

目前我们面临着类似的情况,试图选择一个开发环境来实现嵌入式设备的自动化测试.我们正在研究:

At the moment we are facing a similar situation trying to choose a development environment to implement automation testing for an embedded device. We are looking into:

  • Robot Framework,这是一个基于关键字驱动测试方法的通用验收测试自动化框架.

  • Robot Framework, which is a generic acceptance test automation framework based on keyword-driven testing approach.

FitNesse (http://www.fitnesse.org)

FitNesse (http://www.fitnesse.org)

Pycopia

还有其他不使用 Python 的工具.例如,这个线程 (MxVDev)

There are also other tools that don`t use Python. For example the ones described in this thread (MxVDev)

这篇关于用于在 Python 中测试嵌入式系统的测试框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆