Maurosoft.SonarqubeTestLogger 1.0.3

dotnet add package Maurosoft.SonarqubeTestLogger --version 1.0.3                
NuGet\Install-Package Maurosoft.SonarqubeTestLogger -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Maurosoft.SonarqubeTestLogger" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Maurosoft.SonarqubeTestLogger --version 1.0.3                
#r "nuget: Maurosoft.SonarqubeTestLogger, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Maurosoft.SonarqubeTestLogger as a Cake Addin
#addin nuget:?package=Maurosoft.SonarqubeTestLogger&version=1.0.3

// Install Maurosoft.SonarqubeTestLogger as a Cake Tool
#tool nuget:?package=Maurosoft.SonarqubeTestLogger&version=1.0.3                

Sonarqube Test Logger

Sonarqube xml report extension for Visual Studio Test Platform.

NuGet Downloads

Packages

Logger Stable Package
Sonarqube NuGet Version

Usage

The Sonarqube Test Logger generates xml reports in the Generic test execution report format.

To use the logger, follow these steps:

  1. Add a reference to the Sonarqube Test Logger nuget package in test project

    dotnet add package Maurosoft.SonarqubeTestLogger
    
  2. Use the following command line in tests

    dotnet test --logger:sonarqube
    
  3. Test results are generated in the TestResults directory relative to the test.csproj. The default report name is SonarqubeReportTest.xml

A path for the report file can be specified as follows:

dotnet test --logger:"sonarqube;LogFilePath=test-result.xml"

test-result.xml will be generated in the same directory as test.csproj.

Note: the arguments to --logger should be in quotes since ; is treated as a command delimiter in shell.

Logger Configuration

  • LogFileName: Use LogFileName to specify the name of the output log file. The file will be created in the default results directory (TestResults) relative to test project.

    # Assume we have this directory structure of tests
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    
    > dotnet test --logger:"sonarqube;LogFileName=mytestfile.xml"
    
    # Note the output file
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── TestResults
    │   │   ├── mytestfile.xml    # test result file
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    
  • LogFilePath: Use this option to provide an absolute path for the result file. The parent directory will be created if it doesn't exist.

    # Assume we have this directory structure of tests
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    
    > dotnet test --logger:"sonarqube;LogFilePath=mytestfile.xml"
    
    # Note the output file
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── mytestfile.xml    # test result file
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    
  • Verbose: If true, log message to console

    # Assume we have this directory structure of tests
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    
    > dotnet test --logger:"sonarqube;Verbose=true"
    
    The output on console:
    
    sonarqube - Start
    sonarqube - LogFileName      ->
    sonarqube - LogFilePath      -> mytestfile.xml
    sonarqube - TestRunDirectory -> C:\Users\Test\source\repos\TestProject1\TestProject1\TestResults
    sonarqube - PathSourcesTest: -> C:\Users\Test\source\repos\TestProject1\TestProject1
    sonarqube - Found Test with Namespace -> TestProject1, ClassName -> Class1, MethodName -> TestMethod1 from TestResults
    sonarqube - Found Test with Namespace -> TestProject1, ClassName -> Class1, MethodName -> TestMethod2 from TestResults
    sonarqube - Search test with namespace:TestProject1, classname:Class1, methodname: Test1 from source file -> C:\Users\Test\source\repos\TestProject1\TestProject1\Class1.cs
    sonarqube - Found Namespace TestProject1 into file C:\Users\Test\source\repos\TestProject1\TestProject1\Class1.cs at line 7
    sonarqube - Found Class Class1 into file C:\Users\Test\source\repos\TestProject1\TestProject1\Class1.cs at line 10
    sonarqube - Found Method TestMethod1 into file C:\Users\Test\source\repos\TestProject1\TestProject2\Class1.cs at line 13
    ...
    ...
    sonarqube - End
    
    # Note the output file
    > tree
    .
    │ TestProject1.sln
    ├── TestProject1
    │   ├── TestResults
    │   │   ├── mytestfile.xml    # test result file
    │   ├── UnitTest1.cs
    │   └── TestProject1.csproj
    

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 87 12/3/2024
1.0.1 94 8/2/2024
1.0.0 71 7/31/2024