xUnit Plugin For Team City - xunit

I am trying to use the official xUnit plugin for Team City. I have tried TC 8.1.5, 9.0, and 9.1.1. I am using the latest version of xUnit.
The plugin works. I see xUnit in the build runner list, and when I examine the build log, it is clear that the test assemblies are found.
But the tests do not run.
Here is an excerpt from the build log:
I tried TC 8.1.5, then 9.1.1, and then 9.0.
In all cases, the plugin finds my tests, but it simply does not run them.
Here is an excerpt from the TC 9.0 build log:
[20:14:34] : Step 2/2: xUnit
[20:14:34]i: [Step 2/2] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_2' value='0.0']
[20:14:34] : [Step 2/2] Testing SomeLibraryTests.dll: C:\TeamCity\buildAgent\work\6dc03847e497c6d3\SomeLibraryTests\bin\Release\SomeLibraryTests.dll
[20:14:34] : [Testing SomeLibraryTests.dll] xUnit.net console test runner (64-bit .NET 4.0.30319.18063)
[20:14:34] : [Testing SomeLibraryTests.dll] Copyright (C) 2015 Outercurve Foundation.
[20:14:34] : [Testing SomeLibraryTests.dll]
[20:14:35] : [Testing SomeLibraryTests.dll] Discovering: SomeLibraryTests
[20:14:35] : [Testing SomeLibraryTests.dll] Discovered: SomeLibraryTests
[20:14:35] : [Testing SomeLibraryTests.dll]
[20:14:35] : [Testing SomeLibraryTests.dll] === TEST EXECUTION SUMMARY ===
[20:14:35] : [Testing SomeLibraryTests.dll] SomeLibraryTests.dll Total: 0
Please note that no tests executed.
What am I doing wrong?
Thanks,
Scott

There isn't much to go on from the log excerpt. Is the test assembly referencing xunit v1.x or v2.x, is the runner v1.x or v2.x? It could also be something to do with a framework version or assembly binding mismatch?
You could try the xunit meta-runner I wrote which uses the latest xunit console runner available from nuget.org (or your own nuget feed) rather than the embedded fixed version as the plugin does and see if the test discovery failure is down to the console runner version?

Related

The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located

I am new to .Net and new to SonarScanner with MS Build. I am looking forward for your help on resolving the error I get when I build the project after sonarscanner-msbuild begin process .
C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets(62,5): error : The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located. Project: XYZ.csproj [E:\jenkins\workspace\XYZ\XYZ.csproj]
Tips and clues:
Ensure you have run SonarScanner.MsBuild begin before executing MsBuild
Run MsBuild with /v:diagnostic switch to get detailed troubleshooting log. In the log lookup SonarQubeTargetsPath and SonarQubeTargetFilePath values.
In case of this or another configuration difficulty see my tutorial on how to setup SonarQube in .NET ecosystem: https://blog.pragmasoft.pl/software/2018-10-10-sonarqube-2-setup-environment/

SonarQube not publishing the PHP unit test report

I installed below SonarQube version in Redhat 6 Serer.
Versions :
SonarQube : 6.3
Sonar Runner : 2.3
Sonar PHP Plugin : 2.10.0.2087
My project creates a PHPUnit Test Report in a Directory called "testreports"
sonar.project.properties:
# Required metadata
sonar.projectKey=Dashboard3
sonar.projectName=Dashboard3
sonar.projectVersion=2.0
#sonar.language=php
#Path to Source
sonar.sources=/pkg/vddfg/oradfg/apache/htdocs/Symfony/src/DB3
sonar.sourceEncoding=UTF-8
sonar.php.tests.reportPath=testReports/get_jfm_bug11s_test.xml
sonar.exclusions=**/Metro-UI-CSS-master/**
My Sonar executed successfully, by updating the line as Analyzing PHPUnit test report: testReports/get_jfm_bug11s_test.xml but in SonarQube dashboard we unable to find the Test Report.
How to fix this issue?
1) Use the JUnit output format for your tests (PHPUnit configuration):
<log type="junit" target="tests.xml"/>
2) Add "sonar.tests" to your Sonar properties:
sonar.tests=/path/to/tests

NUnit results not showing up in SonarQube after import

I can't really see if my NUnit reports are being imported in to the SonarQube report suite while I am analyzing a .NET project with the MSBuild scanner.
I'm running SonarQube 5.4 with the SonarQube scanner for MSBuild 2.0 and C# plugin v5.0 (and other non-related plugins, as well)
d:\buildTools\sonar-runner-for-msbuild\MSBuild.SonarQube.Runner.exe begin
/k:$productKey
/n:$productName
/v:$BuildNumber
/d:sonar.cs.nunit.reportsPaths=$NunitTestOutput
While I'm passing in the correct path for the nunit.xml report, it is not being imported into the report suite on SonarQube:
I navigate to (project home) -> Dashboards -> Custom dashboard (where I have added the Unit Tests Coverage widget) but it has no more information other than the number of tests.
Just to be sure, the log also shows that the analyzer knows about the exact location of the nUnit report, but it shows no sign of failure or success either.
2016.05.11 09:28:09 INFO [o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=[Redacted-project-name] | id=[redacted]
[...]
2016.05.11 09:28:11 INFO [o.s.s.c.s.LogScannerContextStep] Settings for module: [Redacted-module-name]
[...]
2016.05.11 09:28:11 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.cs.fxcop.reportPath=E:\WS\12500236\source\src\[Redacted-module-name].dll.CodeAnalysisLog.xml
2016.05.11 09:28:11 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.cs.nunit.reportsPaths=E:\WS\12500236\_testoutput\nunit.xml
2016.05.11 09:28:11 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.cs.roslyn.reportFilePath=E:\WS\12500236\source\src\[Redacted-module-name].dll.RoslynCA_fixed.json
[...]
2016.05.11 09:28:29 INFO [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=[Redacted-project-name] | id=[redacted] | time=20328ms
What should I look for? What am I missing?
I was following this guide to import the NUnit report.
NUnit doesn't have coverage built-in. You need to use some other tool for calculating the coverage.
See Sonar's documentation on code coverage results

StackOverflowException with JetBrains dotCover in TeamCity

I use TeamCity to support continuous integration of a project.
Currently, when I run .NET Code Coverage: JetBrains dotCover for a specific project then the dotCover crashes with StackOverflowException.
Also, the unit test 'TestSomething' is correct and always runs successfully.
Here are the error logs snapshot from the build:
[MyAssembly.dll] MyAssembly.MyTester.TestSomething (12s)
[18:28:37][MyAssembly.MyTester.TestSomething]
[18:28:37][MyAssembly.MyTester.TestSomething] Process is terminated due to StackOverflowException.
[18:28:38][MyAssembly.MyTester.TestSomething] [JetBrains dotCover] Coverage session finished [12/22/2015 6:28:38 PM]
[18:28:38][MyAssembly.MyTester.TestSomething] [JetBrains dotCover] Analysed application exited with code '-1073741571'
[18:28:38][MyAssembly.MyTester.TestSomething] [JetBrains dotCover] Coverage session finished but no snapshots were created.
[18:28:39][MyAssembly.MyTester.TestSomething] ##teamcity[importData type='dotNetCoverage' tool='dotcover' file='C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover33181917853826188801.data']
[18:28:37][Step 3/10]
[18:28:37][Step 3/10] Process is terminated due to StackOverflowException.
I really cannot understand why this happens.
Any help from experts?
This was a bug in JetBrains dotCover.

Using Gradle and the gradle-gae-plugin debug parameters are not passed

I'm using gradle to build, run, deploy my Google App Engine project. The gradle-gae-plugin (version 0.4) seems to work perfect with one caveat. The debug parameters are never passed to the local running engine during gaeRun.
I've changed the http port, so I see at least one parameter taking effect. However, my IDE is rejected on the default 8000 debug port, and netstat shows nothing listening on 8000.
Here is the gae closure from my build.gradle:
gae {
httpPort = 8888
debug = true
debugPort = 8000
}
And the informational log statement coming out of GaeRunTask.groovy of the gradle-gae-plugin
[INFO] [org.gradle.api.plugins.gae.task.GaeRunTask] Using params = [com.google.appengine.tools.development.DevAppServerMain, --port=8888, /[project-dir]/war/build/exploded-war]
gradle version
------------------------------------------------------------
Gradle 1.0-milestone-3
------------------------------------------------------------
Gradle build time: Monday, 25 April 2011 5:40:11 PM EST
Groovy: 1.7.10
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_23 (Sun Microsystems Inc. 19.0-b09)
OS: Linux 2.6.38-8-generic amd64
This is because version 0.4 does not support the debug flag yet. I am currently working on version 0.5 and had already checked in the changes for the README.md file on master. Please refer to tag v0.4 for available convention properties in version 0.4. I will probably push the next version within the upcoming week. As soon as I do I will let you know.

Resources