Idean / sonar-swift

Open source Swift plugin for SonarQube (also supports Objective-C)
Other
896 stars 276 forks source link

"Unable to locate test source file" -> 0 tests count #34

Closed gooner22 closed 8 years ago

gooner22 commented 8 years ago

While uploading analysis to sonar, I get 0 tests count

I noticed following log

INFO: Unable to locate test source file LogicTests/Test.swift

Env:

Notes:

mgrebenets commented 8 years ago

@gooner22

I used fastlane's scan tool too and got similar issue. My JUnit test report looked like this:

xml version='1.0' encoding='UTF-8'?>
<testsuites tests='100' failures='0'>
  <testsuite name='MyUnitTestTargetName.MyClassName' tests='2' failures='0'>

The MyUnitTestTargetName is the name of unit tests target in my project. This kind of report would not be picked up by Sonar then. So I had to patch the report and remove the MyUnitTestTargetName. part, to make it look like this:

xml version='1.0' encoding='UTF-8'?>
<testsuites tests='100' failures='0'>
  <testsuite name='MyClassName' tests='2' failures='0'>

Since it's fastlane I just stuck some extra steps into my Fastfile to have the patching bit automated.

After this my test reports were properly picked up by Sonar plugin.

I'm not sure yet which tool is to blame here. Is it fastlane/scan putting extra info in the test suite name or is it sonar-swift not being flexible enough to strip it out.

I think both tools are the problem here :) scan should have an option to control generation of JUnit reports, sonar-swift should be flexible and understand all kinds of prefixes.

zippy1978 commented 8 years ago

Hi,

I just fixed a bug with Junit Fastlane report naming and the plugin. See https://github.com/Backelite/sonar-swift/issues/29

I will release the fix soon.

Regards

zippy1978 commented 8 years ago

This is fixed in release 0.2.4

gooner22 commented 8 years ago

@zippy1978 thanks!

Pierre-Loup commented 8 years ago

Issue still present in the version 0.2.4 Pull request #28 tires to resolve the issue but hasn't been merge yet.

gooner22 commented 7 years ago

still relevant.

[00:40:06]: ▸ INFO: Unable to locate test source file MY_MODULE/ATests.swift
[00:40:06]: ▸ INFO: Unable to locate test source file MY_MODULE/BTests.swift