Ignore code coverage for unit tests in EclEmma

2019-01-23 01:30发布

I have configured EclEmma not to instrument my unit tests which works fine. However, the editor still highlights the test code as not covered. I want no highlighting in unit tests because they are not instrumented to detect coverage. How can I do this?

2条回答
smile是对你的礼貌
2楼-- · 2019-01-23 01:45

The include/exclude filter settings in the Preferences window apply to class name/package patterns for all projects. To control the files at the folder/path level you must set it per-project.

  1. Right-click the project
  2. Select Coverage As | Coverage Configurations...
  3. Select the project under the Junit subtree
  4. Select the Coverage tab on the right
  5. Uncheck the folder containing your tests, e.g., src/test/java
  6. Click Apply
  7. Click Close (or Coverage to run immediately)

These settings will apply every time you run the coverage in the future without having to open the configuration window.

查看更多
Bombasti
3楼-- · 2019-01-23 02:01

I did this in Preferences->Java->Code Coverage and set the "Only path entries matching" option to src/main/java - seems to work nicely.

查看更多
登录 后发表回答