Scala 测试:SUnit、ScalaTest、ScalaCheck、Specs 和 ParTest 的地位和关系如何?

发布于 2024-11-27 08:49:54 字数 137 浏览 2 评论 0原文

Scala 提供了不同的测试框架的选择,但我想知道它们的成熟度和稳定性以及它们提供的独特功能是否存在差异。

是否有一种特定的方法可以适合所有类型的开发?

不同的框架可以相互操作,或者可以与针对其他语言的测试运行程序进行互操作吗?

Scala provides a choice of different testing frameworks, but I wonder if there are differences in the maturity and stability they have and which distinct features they provide.

Is there a specific one which should fit for all kinds of development?

Can the different frameworks inter-operate with each other or with test runners targeted for other languages?

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

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

发布评论

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

评论(2

小霸王臭丫头 2024-12-04 08:49:54
  • SUnit 不再存在
  • ScalaTest 和 Specs 已经成熟,得到了维护,并且得到了改进(顺便说一下,Specs2 最近发布了)。它们之间的选择取决于品味。
  • ScalaCheck 没有特别好的运行器,但 ScalaTest 和 Specs 都对 ScalaCheck 集成提供了特殊支持。它被认为是一个重要的工具。
  • ParTest 仅用于编译器,因为它测试诸如“这个可以编译吗?”之类的东西。以及“这不能编译吗?”、错误和警告消息等。它不是针对应用程序开发的,因此不应该用于此目的。
  • SUnit no longer exists.
  • ScalaTest and Specs are mature, maintained, and receiving improvements (Specs2 is recently out, by the way). Choice between them is a matter of taste.
  • ScalaCheck doesn't have a particularly good runner, but both ScalaTest and Specs have special support for ScalaCheck integration. It is considered an important tool.
  • ParTest is used just for the compiler, as it tests stuff like "does this compile?" and "does this not compile?", error and warning messages, etc. It is not targeted at application development, and shouldn't be used for that.
久隐师 2024-12-04 08:49:54

ScalaTest 和 Specs 具有非常相似的语法和功能列表,并且都被社区采用。它们都允许单元测试和验收测试。

ScalaCheck 有着完全不同的理念。测试生成随机实例并检查某些属性是否成立。属性和生成器可以用一个很好的函数惯用法来定义和组合。 ScalaTest 和 Specs 允许您在测试中编写 ScalaCheck 属性。

在开始使用 Scala 编程之前,SUnit 已被删除,所以我不知道它是如何工作的。在你提出问题之前我从未听说过 ParTest。

ScalaTest and Specs have a very similar syntax and feature list and they are both adopted by the community. They both allow unit and acceptance tests.

ScalaCheck has a radically different philosophy. Tests generate random instances and check taht some properties hold. Properties and generators can be defined and composed in a nice functional idiom. ScalaTest and Specs allow you to write ScalaCheck properties inside tests.

SUnit was removed before a started programming in Scala so I have no idea how it worked. I never heard of ParTest before your question.

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