Idean / sonar-swift

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

Slather and classname, who's wrong? #30

Closed giacgbj closed 8 years ago

giacgbj commented 8 years ago

Let's say in my project I have a test which is in the directory

tests/some/directories/ATest.swift (test "testAll" inside)

When I produce a cobertura report using slather the result for that class/test is:

<testsuite name='tests.ATest' tests='1' failures='0'>
    <testcase classname='test.ATest' name='testAll' time='0.002'/>
</testsuite>

As you say at https://github.com/Backelite/sonar-swift/blob/master/src/main/java/org/sonar/plugins/swift/tests/SwiftSurefireParser.java, method getUnitTestResource: "Most xcodebuild JUnit parsers don't include the path to the class in the class field, so search for it if it wasn't found in the root"

Unfortunately, neither I have only the class file name (ATest), nor I have a full path (tests/some/directories/ATest.swift): it doesn't include the directories ("some/directories" in the example) between the parent test directory and the test classes.

So, is there something wrong in my project, in slather or in sonar-swift?

In my opinion, you could simply patch your code by removing everything before the latest occurrence of "." in the "classname" attribute and search for the file as you already do.

viteinfinite commented 8 years ago

Hey, it's currently a work in progress in PR #28.

giacgbj commented 8 years ago

Ops, I hadn't noticed it :)