Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code duplication / Unit test number not correct #92

Open
jaernouts opened this issue Jul 28, 2015 · 7 comments
Open

Code duplication / Unit test number not correct #92

jaernouts opened this issue Jul 28, 2015 · 7 comments

Comments

@jaernouts
Copy link

Hello,

I almost set up the project correctly, nevertheless some things are not working. My unit test coverage, my issues are shown correctly and also my number of lines / comments are correct.

Code duplication is not working and I can't find what I'm doing wrong.. Do I have to enable something somewhere? Also, I have a folder 'tests/classes' with subfolders model, viewmodel, etc. If i set 'sonar.tests' to 'tests/classes', the number of tests is not shown (the test coverage is). If I add all the subfolders separately, they do. So it appears that that call is not working recursively. Do I need to change a setting for that or do I really need to add all my subfolders manually?

Kind regards!

Jens

@jaernouts
Copy link
Author

No one...?

@cyrilpicat
Copy link
Contributor

I need to check but if I remember right it's sonar.objectivec.testScheme that is used to run the tests and get the unit test report and coverage report.

sonar.tests is a default SonarQube parameter, I have to check what it exactly does in case of this plugin. What happens if you don't set it?

@jaernouts
Copy link
Author

I indeed set 'sonar.objectivec.testScheme' to my test scheme, so that's correct for sure. The tests are running, so that's not the problem. I also see the coverage report as you see in the image attached, the problem is that I don't see how many Unit Tests I have, how many are succeeded and/or how many are failed...

My folder structure is like this:
<main_folder>:
--app
--tests
----model
------test1.m
------test2.m
------...
----util
------test3.m
------test4.m
------...

When I set sonar.tests to <main_folder>/tests, I have the issue like on the image attached. When I set sonar.tests to <main_folder>/tests/model,<main_folder>/tests/util (so added the subfolders separately), the number of tests are shown correctly. Nevertheless, when I now add a test in <main_folder>/tests, I don't see it added, except when I also add <main_folder>/tests to sonar.tests. But when I try that, I get an error that I can't add a folder multiple times to sonar.tests (because <main_folder>/tests/model/ and <main_folder>/tests/util/ are subfolders of <main_folder>/tests/)

image

@cyrilpicat
Copy link
Contributor

can you check what is the content of TEST-report.xml in the folder 'sonar-reports' at the root of your project? Does it contain all test cases, or only the one from the folders sonar.tests?

I have checked my personal projects, and I am not setting sonar.tests. Could try that?

Otherwise have you tried to put a wildcard in sonar.tests? Like /tests/** (I have not tried it, sorry)?

@jaernouts
Copy link
Author

  • The TEST-report.xml contains all my tests and the total test amount is correct
  • When I remove sonar.tests, I have the same issue (And in the sonar-project.properties you provide as example, there's also stated that removing will just ignore them "# Path to test directories (comment if no test)")
  • I can't use a wildcard, when I do, Sonar cannot be executed: "The folder 'UnitTests/**' does not exist for ..."

Could you maybe give me an example project where you have the same situation working? So with the folder structure I described...?

@mjdetullio
Copy link

Any JUnit reporter for Xcode projects I've tried using does not record a fully qualified class name (with the package representing the directory to the class file) in the XML.

PR #97 fixes this by searching the test sources index for **/ClassName.m. However this only works if the test class name matches the file name it's in. Searching by the real class name would require implementing the lexer.

@sirghi
Copy link

sirghi commented Dec 7, 2016

Hi Cyril, I'm also setting up an objc project and I have the exact same problem. It only looks directly under the folders setup in source.tests, not recursively. I have a mixed objc/swift project, and when I use the swift plugin it drills through all the subfolders and finds the tests.

Hence I think the problem is with the plugin. Do you have any time to look into this?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants