单位/集成测试星号配置 [英] Unit/integration testing Asterisk configuration

查看:189
本文介绍了单位/集成测试星号配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单元和集成测试通常作为开发过程的一部分来执行。我正在寻找在现有系统的配置中使用此方法的方法,在这种情况下 Asterisk soft PBX

Unit and integration testing is usually performed as part of a development process, of course. I'm looking for ways to use this methodology in configuration of an existing system, in this case the Asterisk soft PBX.

在Asterisk的情况下,配置文件与其他程序语言一样多,包括循环,跳转,条件,等等,并且可以变得相当复杂。对配置的更改常常遇到与更改复杂软件产品相同的问题 - 如果没有测试,就很难预见所有的影响。更糟糕的是,系统的性质是与外部实体进行通信,即打电话。

In the case of Asterisk, the configuration file is as much a programming language as anything else, complete with loops, jumps, conditionals, etc., and can get quite complex. Changes to the configuration often suffers from the same problems as changes to a complex software product - it can be hard to foresee all the effects without tests in place. It's made worse by the fact that the nature of the system is to communicate with external entities, i.e. make phone calls.

我有一些关于使用呼叫测试系统的想法文件(在扩展之间创建特定调用),同时观察生成的事件的管理器界面。然后测试可以看到预期的结果,即拨打* 99#应该导致语音邮件应用程序被调用。

I have a few ideas about testing the system using call files (to create specific calls between extensions) while watching the manager interface for generated events. A test could then watch for an expected result, i.e. dialling *99# should result in the Voicemail application getting called.

缺陷是显而易见的 - 它不测试实际结果,只有系统认为是结果,并且它可能需要对被测系统的一些修改。这些测试也很难写得足够强大,只能触发预期的输出,特别是如果系统正在使用(即正在进行其他调用)。

The flaws are obvious - it doesn't test the actual result, only what the system thinks is the result, and it probably requires some modification of the system under test. It's also really hard to write these tests robustly enough to only trigger on the expected output, especially if the system is in use (i.e. there are other calls in progress).

是我想要的,Asterisk的测试系统,不可能?如果没有,你有什么想法,以合理的方式去做这件事吗?我愿意为此付出相当多的开发时间,并在友好的许可下发布结果,但我不确定最好的方法。

Is what I want, a testing system for Asterisk, impossible? If not, do you have any ideas about ways to go about this in a reasonable manner? I'm willing to put a fair amount of development time into this and release the result under a friendly license, but I'm unsure about the best way to approach it.

推荐答案

这显然是一个老问题,所以有一个很好的机会,当原始答案发布在这里,Asterisk不支持单元/集成测试到今天的程度单元测试框架API在12/22/09发布,所以至少存在)。

This is obviously an old question, so there's a good chance that when the original answers were posted here that Asterisk did not support unit / integration testing to the extent that it does today (although the Unit Test Framework API went in on 12/22/09, so that, at least, did exist).

单元测试框架(David的电子邮件列表此处)允许您直接在Asterisk中执行单元测试。测试在框架中注册,并且可以通过CLI执行/查看。因为这是Asterisk的一部分,所以测试被编译成可执行文件。您必须使用--enable-dev-mode选项配置Asterisk,并使用menuselect工具(一些应用程序,如app_voicemail,自动注册测试 - 但他们是少数)来标记测试编译。

The unit testing framework (David's e-mail from the dev list here) lets you execute unit tests directly within Asterisk. Tests are registered with the framework and can be executed / viewed through the CLI. Since this is all part of Asterisk, the tests are compiled into the executable. You do have to configure Asterisk with the --enable-dev-mode option, and mark the tests for compilation using the menuselect tool (some applications, like app_voicemail, automatically register tests - but they're the minority).

写单元测试是相当简单的 - 虽然它(显然)不像一个商业单元测试框架,它完成了工作,可以根据需要增强。

Writing unit tests is fairly straight-forward - and while it (obviously) isn't as fully featured as a commercial unit test framework, it gets the job done and can be enhanced as needed.

这很可能不是大多数Asterisk用户想要使用的 - 尽管Asterisk开发人员非常鼓励查看它。用户和开发人员都可能对集成测试感兴趣, Asterisk测试套件提供。在它的核心,测试套件是一个python脚本,执行其他脚本 - 无论是lua,python等。测试套件有一组python和lua库,帮助编排和执行多个Asterisk实例。测试作者可以使用第三方应用程序,例如SIPp或Asterisk接口(AMI,AGI)或其组合来测试托管的Asterisk实例。

That most likely isn't what the majority of Asterisk users are going to want to use - although Asterisk developers are highly encouraged to check it out. Both users and developers are probably interested in integration tests, which the Asterisk Test Suite provides. At its core, the Test Suite is a python script that executes other scripts - be they lua, python, etc. The Test Suite comes with a set of python and lua libraries that help to orchestrate and execute multiple Asterisk instances. Test writers can use third party applications such as SIPp or Asterisk interfaces (AMI, AGI) or a combination thereof to test the hosted Asterisk instance(s).

到现在在测试套件中的200个测试,更多的添加在相当规律的基础上。你显然可以编写自己的测试,执行你的星号配置,并让它们由测试套件管理 - 如果他们是通用的,你可以提交它们包含在测试套件中。

There are close to 200 tests now in the Test Suite, with more being added on a fairly regular basis. You could obviously write your own tests that exercise your Asterisk configuration and have them managed by the Test Suite - if they're generic enough, you could submit them for inclusion in the Test Suite as well.

请注意,测试套件可能有点难以设置--Leif写了一篇关于设置测试套件的好文章此处。

Note that the Test Suite can be a bit tricky to set up - Leif wrote a good blog post on setting up the Test Suite here.

这篇关于单位/集成测试星号配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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