how to run scalatest at package level in Eclipse

时光总嘲笑我的痴心妄想 提交于 2019-12-10 20:08:13

问题


I'm using ScalaTest in Eclipse (Juno) with Scala 2.10, and the RunConfigurations window has the ability to run a test file, a test suite, or a test package. When I right click on a package name in the explorer window, there is an option to run the package (thereby running all the tests in that package). However, when I do that, no tests run and it displays this:

WARNING: -p has been deprecated and will be reused for a different (but still very cool) purpose in ScalaTest 2.0. Please change all uses of -p to -R.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 57 milliseconds.
Total number of tests run: 0
Suites: completed 1, aborted 0
Tests: succeeded 0, failed 0, ignored 0, pending 0
All tests passed.

So, what else do I need to do so I can run all the tests in the package?


回答1:


This is the blind leading the blind, but what I found was that when you move the test classes into the same package as the tested classes, then the discovery works.

Weird.




回答2:


This is how I got all my tests to run from an Eclipse Run Configurations:

  • Select Run->Run Configurations
  • In the pop-up select the ScalaTest "folder" on the left
  • Click the "New lunch configuration" button in the upper left corner
  • On the Main tab give your test run configuration some meaningful name and ensure that your target project is selected, and then select the "Suite" radiobutton as a Type
  • In the "Suite Class" field, type in the name of a package at a level that is certain to contain all your tests, for example "org.fred.myprog.*". Note the wildcard "*".
  • Hit the Apply button and switch to the Arguments tab
  • In the "VM Arguments" field put something like this "-XX:PermSize=64m -XX:MaxPermSize=256m -Xms256m -Xmx512m". This is needed because the test discovery triggered by the wildcard tends to be memory-hungry.
  • Hit the Apply button and then the Run button.


来源:https://stackoverflow.com/questions/15645113/how-to-run-scalatest-at-package-level-in-eclipse

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