Unit testing Scala

大兔子大兔子 提交于 2019-12-03 05:28:15

问题


I just recently started learning the Scala language and would like to do it in TDD-way. Could you share your experiences on the unit testing frameworks there are for Scala and the pros/cons of them.

I'm using IntelliJ IDEA for Scala development, so it would be nice to be able to run the tests with IDE-support.


回答1:


Have you looked at ScalaTest ?

I've not used it, but it comes from Bill Venners and co at Artima, and consequently I suspect it'll do the job. It doesn't appear to have IDE integration, however.

This blog entry is a little old, but suggests that TestNG is the best option for testing Scala. TestNG will certainly have IDE integrations.

EDIT: I've just realised that I wrote this answer in 2009, and the world has moved on (!). I am currently using ScalaTest, the IDE integration works fine, and I can strongly recommend it. In particular the matcher DSL works very nicely




回答2:


I'm the author of specs. If you're a Intellij user, I advise you to mix-in in the org.specs.runner.ScalaTest trait to your specification and run it as a ScalaTest suite.

If you have any issue with that, or anything else feel free to send a message to the specs-users mailing list.




回答3:


You could also check out Specs it's fairly complete and IIRC is heavily used as part of Lift.



来源:https://stackoverflow.com/questions/741390/unit-testing-scala

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!