GithubHelp home page GithubHelp logo

Comments (10)

a7ex avatar a7ex commented on July 20, 2024

Yes, it should be possible. Unfortunately the paths in the xcresult file are absolut and it is not easy to figure out the relative path names. Sonar however requires the relative paths.
In order for the xcresultparser to figure out how to convert to relative paths you need to pass the root directory as parameter. Then the paths can be converted.

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

Oh maybe I remember wrong and mixed up requirements.

Read the chapter "About paths for the sonarqube scanner" at the end of the Readme. For me that works with sonarqube.

from xcresultparser.

EaseTheWorld avatar EaseTheWorld commented on July 20, 2024

I read the chapter but it is two different things to me.

  1. "The tools to get the data from the xcresult archive yield absolute path names." -> result will look like <file path="Full/Path/LoggingTests.swift">.
  2. "the .xcresult bundle only lists the test by testclass, but not by file." -> result will look like <file path="LoggingTests">

My case is 2. but you're saying 1.
For 1, I can use for sonarqube by replacing some path absolute->relative.
but For 2, I can't do anything about it because I don't have any info about directory.

Am I missing something? or my xcresult file is wrong?(I'm using XCode 14.3, MacOS 13.2)

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

I will look into it, whether xcresult changed lately in this regard. We use the sonar scanner as well with our project and there we can see the tests.
I will see, what I can find out.

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

The xcresult file only shows the class name of the test class. xcresultparser now uses grep to find the file, where your test class is defined. It searches through all files in your "project root" folder for "class " and very naively uses the first matching file. If the string "class " appears more than once it might be the case, that the wrong file is found.

from xcresultparser.

EaseTheWorld avatar EaseTheWorld commented on July 20, 2024

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

Yes, that's exactly what xcresultparser does. The xcresult file provides the name of the test class and xcresultparser greps in the provided project folder for swift files which contain the string 'class name-of-the-testclass'
(I just realised, that what I did in my last response got chopped by GitHub, where I used 'opening-bracket' name-of-test-class 'closing-bracket').
That is a rather "naive" approach and it will break easily, but as far as my research goes, it is the only tool, which converts xcresult files to expose the tests to SonarQube due to this "dirty trick".

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

If you do not run the SonarQube command line tool in the source folder of your project, but rather only have the xcresult file, there is not much I can do about it. The sonarqube command line tool needs to run in the sources folder where the tests are, which created the xcresult. It needs to scan the test files themselves.

from xcresultparser.

EaseTheWorld avatar EaseTheWorld commented on July 20, 2024

I looked into the logic and found ActionTestableSummary includes projectRelativePath, ex. Module1/Domain1/Module1Domain1.xcodeproj.
I think this can optimize the grep logic by narrowing down the search scope. especially for multi-module project.

from xcresultparser.

a7ex avatar a7ex commented on July 20, 2024

Thanks for the hint. I will look into that.

from xcresultparser.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.