在 Akka (Scala) 中测试组件的概率故障
我开始使用 Akka 和 Scala 在面向总线的架构中开发一组交互组件。我需要测试系统的容错能力,为此我想知道是否有任何方法可以在 Scala 测试框架中使用故障概率模型(即为每个 Actor 设置一些故障参数)。有什么想法吗?有没有已经实现这个的框架?
I've started using Akka with Scala to develop a set of interacting components in a bus-oriented architecture. I need to test the fault-tolerance of the system, and for that I was wondering if there is any way to use a probabilistic model of failure (i.e., set some failure parameters for each Actor) within a Scala test framework. Any ideas? Any framework out there that already implements this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您知道像 Testkit 一样思考并阅读 http:// /akka.io/docs/akka/1.3/scala/testing.html#akka-testkit (另请参阅http://roestenburg.agilesquad.com/2011/02 /unit-testing-akka-actors-with-testkit_12.html )
如果我理解你的问题,你不需要在测试设置中使用 Akka 正确的。假设Akka本身经过测试并且工作正常。现在您只需测试您的代码。由于您没有显示代码,所以很难提供建议,但我会尝试:
您可以以不同的顺序测试方法调用,并断言结果。我会对序列进行硬编码,但您也可以将其随机化。
显示一些代码,我会澄清我的意思。如果我错误地理解了你的问题,我也可能是错的。
I assume you know thinks like Testkit and read the documentation at http://akka.io/docs/akka/1.3/scala/testing.html#akka-testkit (see also http://roestenburg.agilesquad.com/2011/02/unit-testing-akka-actors-with-testkit_12.html )
You don't need Akka in the test setup, if I understood your problem right. Assume that Akka itself is tested and works OK. Now you only have to test your code. Since you didn't show code it's hard to give advice, but I will try:
you can test your method calls in different sequences, and assert the results. I would hardcode the sequences, but you can also randomize that.
show some code and I will clarify what I mean. I also could be wrong, if I understood your question wrong.