Hi Team,
after running the build, i can see Code smell, but it’s not showing code coverage, everytime it shows 0% ,
please look at the below message
‘sonar.coverage.jacoco.xmlReportPaths’ is not defined’
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=3ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
It’s not clear to me that your test script produces a coverage report. Should it? Does it? Is the report non-empty? Is it output to one of the default locations?
Hi @ganncamp ,
First i ran the script without putting test code, but after running the scan i was unable to see any code coverage it was 0%, After few search on internet i got to know that if we run with test case DLL, it shows code coverage, then i tried by writing the test code, still it’s not working.
To execute tests when i am writing below code,
dotnet test
Or
dotnet test --logger trx
in log it’s showing message " No such property: test for class"
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: test for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:271)
at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:357)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.Build(WorkflowScript:38)
Yes, i am using .NET and i followed the url (Thanks for sharing), but could not do changes enough to make it work.
Could you please suggest me how can we run Unit test cases and get code coverage.
As i am not finding jacocoTestReport.xml anywhere.
Thanks,
You’re not going to get a JaCoCo report out of .NET testing. Unfortunately our analysis logging is a bit chatty on that point, but you can just ignore it.
As far as how to run your tests, I’m afraid that’s a bit out of scope for us here.