dodobrands/dbxcresultparser-sonar
⚠️ Notice: This formatter has been integrated into Peekie (formerly DBXCResultParser) as
SonarFormatter. We recommend using Peekie instead of this repository for new projects and migrating existing projects to Peekie. Peekie pro
Usage
As a Command Line Tool
You can use DBXCResultParser-Sonar as a command line tool in two ways:
- Prebuilt Binary from Xcode Archive:
1. Clone repo 2. Open in Xcode 3. Product → Archive 4. Distribute Content → Built Products 5. Run exported binary: ``bash ./DBXCResultParser-Sonar --xcresult-path <path> --tests-path <your projects tests folder> ``
- Using Swift Run:
Clone the repository and run the tool using the Swift Package Manager:
``bash git clone https://github.com/dodobrands/DBXCResultParser-Sonar.git cd DBXCResultParser-Sonar swift run DBXCResultParser-Sonar --xcresult-path <path> --tests-path <your projects tests folder> ``
Saving .xml report to file
You can save report in two ways:
- Using
>operator:
Append > at the end of any bash command to redirect it's output into file. ``bash ./DBXCResultParser-Sonar --xcresult-path <path> --tests-path <your projects tests folder> > sonar-test-report.xml ``
- Using
--output-pathoption:
Specify option for resulting file. May be useful when you've provided --verbode flag so that it's logs won't conflict with output .xml. ``bash ./DBXCResultParser-Sonar --xcresult-path <path> --tests-path <your projects tests folder> --output-path <path to resulting report.xml> ``
As a Dependency
To use DBXCResultParser-Sonar in your Swift package, add it to the dependencies for your Package.swift file:
let package = Package(
name: "YourPackageName",
dependencies: [
.package(url: "https://github.com/dodobrands/DBXCResultParser-Sonar", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(
name: "YourTargetName",
dependencies: ["DBXCResultParser"]
)
]
)To parse an .xcresult file and access the report data, initialize a DBXCReportModel with the path to the .xcresult file:
import DBXCResultParser_Sonar
let xcresultPath = URL(fileURLWithPath: "/path/to/your.xcresult")
let reportModel = try DBXCReportModel(xcresultPath: xcresultPath)
let formatter = SonarGenericTestExecutionReportFormatter()
let result = try formatter.sonarTestReport(from: reportModel)Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue on the GitHub repository.
License
This project is licensed under the Apache License - see the LICENSE file for details.
Package Metadata
Repository: dodobrands/dbxcresultparser-sonar
Default branch: main
README: README.md