单元测试 Modelica 组件库? [英] Unit testing Modelica component library?

查看:70
本文介绍了单元测试 Modelica 组件库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Modelica 中创建一个组件库,希望能提供一些有关单元测试包的技术的意见.

I'm creating a library of components in Modelica, and would appreciate some input on techniques for unit testing the package.

到目前为止,我有一个测试包,由一组模型组成,每个组件一个.每个测试模型都会实例化一个组件,并将其连接到一些提供必要输入和输出的非常简单的辅助类.

So far I have a test package, consisting of a set of models, one per component. Each test model instantiates a component, and connects it to some very simple helper classes that provide the necessary inputs and outputs.

这在 OMEditor 中以交互方式使用时效果很好,但我正在寻找具有通过/失败标准等的更自动化的解决方案.

This works fine when using it interactively in the OMEditor, but I'm looking for a more automated solution with pass/fail criteria etc.

我应该开始编写 .mos 脚本,还是有其他/更好的方法?

Should I start writing .mos scripts, or is there another/better way ?

谢谢.

推荐答案

我喜欢 Openmodelica 测试结果的样子,见

I like how Openmodelica testing results look, see

不过不知道他们是怎么做的.显然已经完成了某种回归测试,并存储了以前的结果,但不知道这是来自某个测试库还是自制的.

No idea how they are doing it, though. Obviously some kind of regression testing is done, with previous results stored, but no idea if that is from some testing library or self-made.

总的来说,我觉得有点悲哀/次优,没有每个人都可以/应该使用的唯一"测试解决方案(参见 Python 生态系统中的鼻子或 pytest),相反,每个人似乎都在制作他们的自己的解决方案(或尝试),您所找到的只是一些 Modelica 会议论文(通常没有实施痕迹)或未维护的未知状态库.

In general, I find it kinda sad/suboptimal, that there isn't "the one" testing solution everybody can/should use (cf. e.g. nose or pytest in the python ecosystem), instead everybody seems to cook up their own solutions (or tries to), and all you find is some Modelica conference papers (often without a trace of implementation) or unmaintained library of unknown status.

在我的脑海里,我发现/知道(有些已经在这里的其他答案中链接了)

Off the top of my head, I found/know of (some already linked in other answers here)

  • OM testing
  • JModelica testing (seems to only test for compiler errors?)
  • Xogeny test (Some tests of the library itself fail for me. Also, does not seem to include a test runner)
  • MoUnit (something by Fraunhofer, and not publically available - maybe in OneWind/OneModelica?)
  • UnitTesting (apparently some kind of predecessor of XogenyTest. Also, no sources/implementation found)
  • Optimica Testing Toolkit (apparently a commercial product by Modelon)
  • SystemModeler VerificationTest
  • buildingspy Python package, for regression testing among other things. Under the umbrella of the Berkeley Modelica Buildings Library. (Simulation only with Dymola)
  • Modelica_Requirements library -- define requirements for simulation. (claimed to be open source and implemented, but apparently not available anywhere)
  • ... I'm sure there are more I have forgotten or am not aware of

这似乎是 https://xkcd.com/927/ 的病态实例.对于(非开发人员)用户来说,几乎不可能知道选择哪些,哪些实际上是好的/可用/可用/...

This seems like a pathological instance of https://xkcd.com/927/. It's kinda impossible for a (non-dev) user to know which of those to choose, which are actually good/usable/available/...

(不是真正的测试,但也相关:使用 ANTLR 进行解析和语义分析:modelica.org/events/Conference2003/papers/h31_parser_Tiller.‌ pdf)

(Not real testing, but also relevant: parsing and semantic analysis using ANTLR: modelica.org/events/Conference2003/papers/h31_parser_Tiller.‌​pdf)

这篇关于单元测试 Modelica 组件库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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