在Groovy中编写的测试没有单元测试成功数据 [英] No Unit Test Success data for tests written in Groovy

查看:320
本文介绍了在Groovy中编写的测试没有单元测试成功数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一年多的时间里,我还没有在混合Java和Groovy文件的项目中使用Sonar,SonarQube能够在同一个项目/模块中支持多种语言(而不是分别为Java和Groovy的)。不幸的是我发现了一个回归。



过去对于使用Spock / Groovy编写测试的Java项目,他们通常在测试总结中报告。目前对于那些项目,整个单元测试成功部分缺失。看来问题在于那些数据只是提供给SurefireSensor。在测试Spock的Java项目中,有警告:

$ p $ INFO - Sensor SurefireSensor
INFO - 解析/ home / foo / my-gradle-project / build / test-results
WARN - 找不到资源:io.foobar.FileSystemPollerSpec
WARN - 找不到资源:io.foobar.PropertiesFolderFinderSpec


类似的情况是完全在Groovy中的项目。在这种情况下,SurefireSonsor甚至没有执行,并且单元测试成功完全丢失。这个问题可以复制:
https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/groovy/groovy-sonar-runner-jacoco



使用SonarQube 5.1.1,Java插件3.0,Groovy插件1.1.1和SonarRunner 2.4进行测试。

是否有其他方式可以获得单元测试成功Groovy / Spock for Groovy中的测试还是混合的Java / Groovy项目?

解决方案

这是Groovy插件的一个已知限制。有一张开放票: http://jira.sonarsource.com/browse/SONARGROOV-2
它应该在下一次冲刺中得到解决。


I haven't used Sonar in project with mixed Java and Groovy files for over a year and it is great that SonarQube has become able to support multiple languages in the same project/module (instead of making two separate analyzes for Java and Groovy). Unfortunately I spotted a regression.

In the past for Java project with tests written in Spock/Groovy they were normally reported in a test summary. Currently for that projects there is entire "Unit test success" section missing. It seems that the problem is that those data are provided only but SurefireSensor. In Java project with tests in Spock there are warnings:

INFO  - Sensor SurefireSensor
INFO  - parsing /home/foo/my-gradle-project/build/test-results
WARN  - Resource not found: io.foobar.FileSystemPollerSpec
WARN  - Resource not found: io.foobar.PropertiesFolderFinderSpec

Looking a the code SurefireSonsor gathers only Java source files and skips results for other files (in the past there were gathered, only source files were not displayed)

Similar situation is for a project completely in Groovy. In that case SurefireSonsor is not even executed and "Unit test success" is completely missing. The issue can be reproduced with: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/groovy/groovy-sonar-runner-jacoco

Tested with SonarQube 5.1.1, Java plugin 3.0, Groovy plugin 1.1.1 and SonarRunner 2.4.

Is there any other way to get "Unit test success" for tests in Groovy/Spock for Groovy or mixed Java/Groovy projects?

解决方案

This is a known limitation of the Groovy plugin. There is an open ticket: http://jira.sonarsource.com/browse/SONARGROOV-2 It should be fixed in next sprint.

这篇关于在Groovy中编写的测试没有单元测试成功数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆