Skip to content

Any chance at a way to combine sub-project reports into one? #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agemooij opened this issue May 25, 2014 · 61 comments
Closed

Any chance at a way to combine sub-project reports into one? #13

agemooij opened this issue May 25, 2014 · 61 comments

Comments

@agemooij
Copy link

I've just started using the sbt-scoverage plugin and my first impression is that it is much better than jacoco or scct. Great work!

My current project has multiple sub-projects and I was wondering whether you see a way to combine the outputs of all the individual tests into one big report across all projects. Do you think this is possible?

I'm more than willing to help add this feature. At this point I'm just not sure how hard/easy it would be and where to start.

Again, great work!
Age

@0xRoch
Copy link
Member

0xRoch commented May 26, 2014

Hi Age !

There was a request for multi-project reports,
This feature was implemented in SCCT but hasn't been ported to Scoverage yet.

https://github.com/mtkopone/sbt-scct/blob/master/src/main/scala/ScctPlugin.scala#L96

I think the ticket was deleted by error

@sksamuel
@dmicol
@sortega

@agemooij
Copy link
Author

Then please consider this ticket its replacement. Multi-project merged reports would be a very welcome addition!

If you guys don't have time, I'll try to improve my SBT plugin skills so I can produce a pull request but it might take a while ;)

@sksamuel
Copy link
Member

sksamuel commented Jun 1, 2014

I'm going to get it finished before scaladays as I want to release version 1.0 prior to that.

@agemooij
Copy link
Author

agemooij commented Jun 2, 2014

Awesome, thanks!

@pcleary00
Copy link

Any update on this feature yet? Scaladays is over ;P Just curious, I could definitely use the merged reports for a multi-module build. (great plugin btw)

@YannMoisan
Copy link
Contributor

+1 for this feature.

@sksamuel
Copy link
Member

Current status is the merging works, I just need to update the sbt plugin
now, so we're talking a couple more days

On 23 July 2014 09:29, Yann Moisan [email protected] wrote:

+1 for this feature.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@pcleary00
Copy link

Nice! I will be glad to test it out on our multi-module build once it is ready

@nlochschmidt
Copy link

I am really looking forward to this. Any news? Also if it's not completly ready yet maybe you could still provide it in a branch so that we can help and give feedback.

@ghost
Copy link

ghost commented Aug 16, 2014

+1 for this.

@agemooij
Copy link
Author

Hi there? Any updates on this issue?

@fernandoracca
Copy link

+1 for Multi Module aggregated report.

@sortega
Copy link

sortega commented Nov 5, 2014

+1

@nightwolfzor
Copy link

+1 for this - really need multi-project support!

@sksamuel any chance we can see code so I can build myself?

@sksamuel
Copy link
Member

The code is pushed. If you build from master, then it should/may work, but I've not tested it much yet.

@massenz
Copy link

massenz commented Nov 17, 2014

Thanks!
I'm using sbt-scoverage to integrate with coveralls (via Travis) - building from master is really not an option, but I'm happy to wait: do you have an ETA for when this will make it to the next release?

Really great work, thanks!

@sksamuel
Copy link
Member

I'm hoping to release 1.0 final next few days. Just need to write
integration tests for multi project aggregation.
On 17 Nov 2014 07:31, "Marco Massenzio" [email protected] wrote:

Thanks!
I'm using sbt-scoverage to integrate with coveralls (via Travis) -
building from master is really not an option, but I'm happy to wait: do you
have an ETA for when this will make it to the next release?

Really great work, thanks!


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel
Copy link
Member

@massenz @sortega @nightwolfzor @fractal @agemooij @diwalak @nlochschmidt

Multiproject support is now in beta3.
1.0.0.BETA3

You need to now run with
sbt coverage test and you need SBT 0.13.5 or higher.
Also remove instrumentSettings from your build.sbt
Once the coverage is complete, aggregate with sbt coverageAggregate
The keys have been slightly renamed so they all begin with coverageXXYYY

Any questions please ask, this is a big release, so perhaps some new bugs.

@massenz
Copy link

massenz commented Nov 19, 2014

I've been trying to use 1.0.0.BETA3 - it apparently gets downloaded and installed (I can see it inside .ivy2/cache/org.scoverage):

[info] downloading http://repo1.maven.org/maven2/org/scoverage/scalac-scoverage-plugin_2.10/1.0.0.BETA3/scalac-scoverage-plugin_2.10-1.0.0.BETA3.jar ...
[info]  [SUCCESSFUL ] org.scoverage#scalac-scoverage-plugin_2.10;1.0.0.BETA3!scalac-scoverage-plugin_2.10.jar (336ms)
[info] Done updating.

And I can see the new coverageExcludedPackages key in the source code here: as far as I can tell, it is in the coverage package, so I am using it like this:

scoverage.coverageExcludedPackages := ".*Reverse.*"

However, SBT gets angry at me with:

[info] Loading project definition from /home/marco/workspaces/scala/sentinel/project
/home/marco/workspaces/scala/sentinel/build.sbt:15: error: object coverageExcludedPackages is not a member of package scoverage
scoverage.coverageExcludedPackages := ".*Reverse.*"

and, obviously, if I remove the scoverage. it fails just the same.
Any suggestions as to what may be possibly going wrong?
(I did an sbt clean to start with, so this should work? also, I'm using Scala 2.11 - does it matter?)

Thanks!

@massenz
Copy link

massenz commented Nov 19, 2014

BTW - where is the "aggregated" report placed?

$ sbt coverageAggregate    
[info] Loading project definition from /home/marco/workspaces/scala/sentinel/project
[info] Set current project to sentinel (in build file:/home/marco/workspaces/scala/sentinel/)
[info] Aggregating coverage from subprojects.../home/marco/workspaces/scala/sentinel/target/scala-2.11
[info] Aggregating coverage from subprojects.../home/marco/workspaces/scala/sentinel/sentinel_core/target/scala-2.11
[info] Found 1 subproject report files
[info] Found 1 subproject report files
[success] Total time: 0 s, completed Nov 18, 2014 11:57:25 PM

But when I look in the top-level project, the index.html still looks exactly the same - as does the "core" sub-project.

Running a $ find . |egrep ".html$" does not yield much of an insight: as far as I can tell, there are no new reports?

@sksamuel
Copy link
Member

The aggregate report overwrites the old one, but you've found a bug. I'll
fix that and do beta4.

As for the keys, you can do
ScoverageSbtPlugin.autoImport.coverageExcludedPackages
:= "qeqweqwe"

I don't know why its not "auto importing" like it should.

On 19 November 2014 08:03, Marco Massenzio [email protected] wrote:

BTW - where is the "aggregated" report placed?


[info] Loading project definition from
/home/marco/workspaces/scala/sentinel/project
[info] Set current project to sentinel (in build
file:/home/marco/workspaces/scala/sentinel/)
[info] Aggregating coverage from
subprojects.../home/marco/workspaces/scala/sentinel/target/scala-2.11
[info] Aggregating coverage from
subprojects.../home/marco/workspaces/scala/sentinel/sentinel_core/target/scala-2.11
[info] Found 1 subproject report files
[info] Found 1 subproject report files
[success] Total time: 0 s, completed Nov 18, 2014 11:57:25 PM

But when I look in the top-level project, the `index.html` still looks exactly the same - as does the "core" sub-project.

—
Reply to this email directly or view it on GitHub
https://github.com/scoverage/sbt-scoverage/issues/13#issuecomment-63604612
.

@agemooij
Copy link
Author

FYI, SBT autoImports currently only work for .sbt files using the old syntax. Both .scala builds en .sbt builds using the new syntax (defining the project directly as a val) will need to import the autoImport object directly.

I've tried various ways of working around this in my own plugin but so far nothing better has turned up, just "double import" warnings from the compiler.

@sksamuel
Copy link
Member

lol so auto import doesn't really work? Typical sbt. Thanks for the info.

I'll rename it back to keys then so its clear that it won't be auto
imported.

On 19 November 2014 09:53, Age Mooij [email protected] wrote:

FYI, SBT autoImports currently only work for .sbt files using the old
syntax. Both .scala builds en .sbt builds using the new syntax (defining
the project directly as a val) will need to import the autoImport object
directly.

I've tried various ways of working around this in my own plugin but so far
nothing better has turned up, just "double import" warnings from the
compiler.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@agemooij
Copy link
Author

I'm sure the plan is that eventually it will work. It just doesn't yet.

@sksamuel
Copy link
Member

I can update the keys in another release, right now I think it would be
confusing to have to import autoImport

On 19 November 2014 10:45, Age Mooij [email protected] wrote:

I'm sure the plan is that eventually it will work. It just doesn't yet.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel
Copy link
Member

Bet4 is out, if you want to give it a go. autoImports is renamed to ScoverageKeys @massenz @agemooij I've fixed the bug with aggregation where it wouldn't find sub projects.

@agemooij
Copy link
Author

I updated my build and ran coverage, test, and then coverageAggregate. Everything seems to have gone well but, like @massenz I cannot find the aggregated report anywhere. It's not in the root target directory where I would expect it and it's not in any of the sub project target directories either.

@sksamuel
Copy link
Member

What version of sbt?

All I can find is this:
http://stackoverflow.com/questions/16614794/illegalstateexception-impossible-to-get-artifacts-when-data-has-not-been-loaded

On 20 November 2014 10:03, Yann Simon [email protected] wrote:

I oversee that, thanks!

I change it to %, but the error stays the same.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@yanns
Copy link
Contributor

yanns commented Nov 20, 2014

I tried sbt 0.13.5, 0.13.6 and 0.13.7.

I have play as dependency.
I guess it is a problem with ivy, grrrr..

@agemooij
Copy link
Author

I do indeed have a large xml file containing information from multiple sub projects in the <root>/target/scala-2.11/scoverage-report directory.

Looking forward to see the rendered report

@sksamuel
Copy link
Member

Yep that's going in, then that's release 1.0 going out.

On 20 November 2014 11:14, Age Mooij [email protected] wrote:

I do indeed have a large xml file containing information from multiple sub
projects in the /target/scala-2.11/scoverage-report directory.

Looking forward to see the rendered report?


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel sksamuel reopened this Nov 20, 2014
@sksamuel
Copy link
Member

Release 1.0.0 is out now with readme updated.

@massenz
Copy link

massenz commented Nov 21, 2014

[side note: %% in the dependencies list automatically appends the right scala version (_2.10, _2.11 etc.) - it works just fine for me:

addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "1.0.0")

end side-note]

Good news and bad news :)
The coverageAggregate does do something now:

$ sbt coverageAggregate
[info] Loading project definition from /home/marco/workspaces/scala/sentinel/project
[info] Set current project to sentinel (in build file:/home/marco/workspaces/scala/sentinel/)
[info] Aggregating coverage from subprojects...
[info] Found 2 subproject report files [/home/marco/workspaces/scala/sentinel/target/scala-2.11/scoverage-report/scoverage.xml,/home/marco/workspaces/scala/sentinel/sentinel_core/target/scala-2.11/scoverage-report/scoverage.xml]
[info] Generating scoverage reports...
[info] Written Cobertura report [/home/marco/workspaces/scala/sentinel/target/scala-2.11/coverage-report/cobertura.xml]
[info] Written XML coverage report [/home/marco/workspaces/scala/sentinel/target/scala-2.11/scoverage-report/scoverage.xml]
[info] Written HTML coverage report [/home/marco/workspaces/scala/sentinel/target/scala-2.11/scoverage-report/index.html]
[info] Coverage reports completed
[info] Aggregation complete. Coverage was [50.00]
[success] Total time: 0 s, completed Nov 20, 2014 10:02:30 PM

unfortunately, at least in my case, it's not what it's supposed to be.
Essentially the overwritten report contains a small and incomplete subset of the classes: see attached images, for the main project, the sub-project and the post-aggregate report.

Looking at the XML it looks as if that's the broken one.
As usual, the project is open to see here: http://github.com/massenz/sentinel

Main project
main-proj

Sub-project (core)
subproject

Post-aggregate
main-post-aggregate

@yanns
Copy link
Contributor

yanns commented Nov 26, 2014

For info, I fixed my problem with
dependencyOverrides += "org.scala-lang" % "scala-library" % scalaVersion.value

Now the code coverage is running, but I have the same problem as @massenz : the aggregated report contains much less data than the individual ones.

@sksamuel
Copy link
Member

Do any of you have a sample project that re-creates this aggregated report
error, because I can't duplicate it yet.

On 26 November 2014 at 09:42, Yann Simon [email protected] wrote:

For info, I fixed my problem with
dependencyOverrides += "org.scala-lang" % "scala-library" %
scalaVersion.value

Now the code coverage is running, but I have the same problem as @massenz
https://github.com/massenz : the aggregated report contains much less
data than the individual ones.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@yanns
Copy link
Contributor

yanns commented Nov 26, 2014

I do not have any, but maybe you could use the project from @massenz ?

@sksamuel
Copy link
Member

Ah yes didn't see that.

@massenz
Copy link

massenz commented Nov 26, 2014

Awfully sorry, guys, I realize that I never posted here (but have somewhere else, I'm sure).
This issue is now resolved with the 1.0.0 release: the reports get correctly merged and all the files' coverage is available in the 'top-level' project.

I'm not sure what the "fix" proposed by @yanns does, but I can confirm I did have an sbt import issue at first, which I fixed by clearing the .ivy2/cache contents for the plugin.

As you can see in my sentinel the coverage is now correctly reported at 84% (see also the coveralls report).

The only thing that mars this landscape is the broken sbt-coveralls plugin.

@agemooij
Copy link
Author

I'm sorry but I'm not having a lot of luck with the 1.0.0 version. It's a client project so I can't put code online but it has about 10 sub-projects.

Clearing the Ivy cache somehow made it even worse since running coverage followed by test produced a whole slew of nullpointer exception during report generation. No html reports were created as a result.

...<other projects output snipped>...
[info] Reading scoverage instrumentation [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-data/scoverage.coverage.xml]
[info] Reading scoverage measurements...
[info] Generating scoverage reports...
[info] Written Cobertura report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/coverage-report/cobertura.xml]
[info] Written XML coverage report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-report/scoverage.xml]
[info] Written HTML coverage report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-report/index.html]
[trace] Stack trace suppressed: run last rebb-salesforce/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-product/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-auth/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-website/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-common-cassandra/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-shopper/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-ga/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-exacttarget/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-common/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-order/test:executeTests for the full output.
[error] (rebb-salesforce/test:executeTests) java.lang.NullPointerException
[error] (rebb-product/test:executeTests) java.lang.NullPointerException
[error] (rebb-auth/test:executeTests) java.lang.NullPointerException
[error] (rebb-website/test:executeTests) java.lang.NullPointerException
[error] (rebb-common-cassandra/test:executeTests) java.lang.NullPointerException
[error] (rebb-shopper/test:executeTests) java.lang.NullPointerException
[error] (rebb-ga/test:executeTests) java.lang.NullPointerException
[error] (rebb-exacttarget/test:executeTests) java.lang.NullPointerException
[error] (rebb-common/test:executeTests) java.lang.NullPointerException
[error] (rebb-order/test:executeTests) java.lang.NullPointerException
[error] Total time: 17 s, completed Nov 26, 2014 9:16:06 PM

Any ideas?

Stacktrace details:

java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:129)
    at scala.io.BufferedSource.reader(BufferedSource.scala:22)
    at scala.io.BufferedSource.bufferedReader(BufferedSource.scala:23)
    at scala.io.BufferedSource.scala$io$BufferedSource$$charReader$lzycompute(BufferedSource.scala:33)
    at scala.io.BufferedSource.scala$io$BufferedSource$$charReader(BufferedSource.scala:31)
    at scala.io.BufferedSource$$anonfun$iter$1$$anonfun$apply$mcI$sp$1.apply$mcI$sp(BufferedSource.scala:38)
    at scala.io.Codec.wrap(Codec.scala:68)
    at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
    at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
    at scala.collection.Iterator$$anon$9.next(Iterator.scala:162)
    at scala.collection.Iterator$$anon$17.hasNext(Iterator.scala:511)
    at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
    at scala.io.Source.hasNext(Source.scala:226)
    at scala.collection.Iterator$class.foreach(Iterator.scala:727)
    at scala.io.Source.foreach(Source.scala:178)
    at scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320)
    at scala.io.Source.addString(Source.scala:178)
    at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286)
    at scala.io.Source.mkString(Source.scala:178)
    at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:288)
    at scala.io.Source.mkString(Source.scala:178)
    at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:290)
    at scala.io.Source.mkString(Source.scala:178)
    at scoverage.IOUtils$.readStreamAsString(IOUtils.scala:16)
    at scoverage.report.ScoverageHtmlWriter.write(ScoverageHtmlWriter.scala:18)
    at scoverage.ScoverageSbtPlugin.scoverage$ScoverageSbtPlugin$$writeReports(ScoverageSbtPlugin.scala:202)
    at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ScoverageSbtPlugin.scala:135)
    at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ScoverageSbtPlugin.scala:134)
    at scala.Option.foreach(Option.scala:236)
    at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1.apply$mcV$sp(ScoverageSbtPlugin.scala:133)
    at sbt.Tests$$anonfun$Cleanup$1.apply(Tests.scala:53)
    at sbt.Tests$$anonfun$Cleanup$1.apply(Tests.scala:53)
    at sbt.Tests$$anonfun$sbt$Tests$$partApp$1$1$$anonfun$apply$1.apply$mcV$sp(Tests.scala:160)
    at sbt.Tests$$anonfun$sbt$Tests$$fj$1$1.apply(Tests.scala:159)
    at sbt.Tests$$anonfun$sbt$Tests$$fj$1$1.apply(Tests.scala:159)
    at sbt.std.TaskExtra$$anon$1$$anonfun$fork$1$$anonfun$apply$1.apply(TaskExtra.scala:99)
    at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
    at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[error] (rebb-salesforce/test:executeTests) java.lang.NullPointerException

@massenz
Copy link

massenz commented Nov 27, 2014

Try 'sbt clean test' first
Cleaning the cache, but not the compiled code will cause the problem.

Only after all your tests pass, you can run coverage.

sent from my Nexus
On Nov 26, 2014 12:28 PM, "Age Mooij" [email protected] wrote:

I'm sorry but I'm not having a lot of luck with the 1.0.0 version. It's a
client project so I can't put code online but it has about 10 sub-projects.

Clearing the Ivy cache somehow made it even worse since running coverage
followed by test produced a whole slew of nullpointer exception during
report generation. No html reports were created as a result.

......
[info] Reading scoverage instrumentation [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-data/scoverage.coverage.xml]
[info] Reading scoverage measurements...
[info] Generating scoverage reports...
[info] Written Cobertura report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/coverage-report/cobertura.xml]
[info] Written XML coverage report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-report/scoverage.xml]
[info] Written HTML coverage report [/Users/age/Development/src/wehkamp/rebb-site/rebb-product/target/scala-2.11/scoverage-report/index.html]
[trace] Stack trace suppressed: run last rebb-salesforce/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-product/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-auth/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-website/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-common-cassandra/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-shopper/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-ga/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-exacttarget/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-common/test:executeTests for the full output.
[trace] Stack trace suppressed: run last rebb-order/test:executeTests for the full output.
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
error java.lang.NullPointerException
[error] Total time: 17 s, completed Nov 26, 2014 9:16:06 PM

Any ideas?

Stacktrace details:

java.lang.NullPointerException
at java.io.Reader.(Reader.java:78)
at java.io.InputStreamReader.(InputStreamReader.java:129)
at scala.io.BufferedSource.reader(BufferedSource.scala:22)
at scala.io.BufferedSource.bufferedReader(BufferedSource.scala:23)
at scala.io.BufferedSource.scala$io$BufferedSource$$charReader$lzycompute(BufferedSource.scala:33)
at scala.io.BufferedSource.scala$io$BufferedSource$$charReader(BufferedSource.scala:31)
at scala.io.BufferedSource$$anonfun$iter$1$$anonfun$apply$mcI$sp$1.apply$mcI$sp(BufferedSource.scala:38)
at scala.io.Codec.wrap(Codec.scala:68)
at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
at scala.collection.Iterator$$anon$9.next(Iterator.scala:162)
at scala.collection.Iterator$$anon$17.hasNext(Iterator.scala:511)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
at scala.io.Source.hasNext(Source.scala:226)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.io.Source.foreach(Source.scala:178)
at scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320)
at scala.io.Source.addString(Source.scala:178)
at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286)
at scala.io.Source.mkString(Source.scala:178)
at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:288)
at scala.io.Source.mkString(Source.scala:178)
at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:290)
at scala.io.Source.mkString(Source.scala:178)
at scoverage.IOUtils$.readStreamAsString(IOUtils.scala:16)
at scoverage.report.ScoverageHtmlWriter.write(ScoverageHtmlWriter.scala:18)
at scoverage.ScoverageSbtPlugin.scoverage$ScoverageSbtPlugin$$writeReports(ScoverageSbtPlugin.scala:202)
at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ScoverageSbtPlugin.scala:135)
at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ScoverageSbtPlugin.scala:134)
at scala.Option.foreach(Option.scala:236)
at scoverage.ScoverageSbtPlugin$$anonfun$postTestReport$1$$anonfun$apply$1.apply$mcV$sp(ScoverageSbtPlugin.scala:133)
at sbt.Tests$$anonfun$Cleanup$1.apply(Tests.scala:53)
at sbt.Tests$$anonfun$Cleanup$1.apply(Tests.scala:53)
at sbt.Tests$$anonfun$sbt$Tests$$partApp$1$1$$anonfun$apply$1.apply$mcV$sp(Tests.scala:160)
at sbt.Tests$$anonfun$sbt$Tests$$fj$1$1.apply(Tests.scala:159)
at sbt.Tests$$anonfun$sbt$Tests$$fj$1$1.apply(Tests.scala:159)
at sbt.std.TaskExtra$$anon$1$$anonfun$fork$1$$anonfun$apply$1.apply(TaskExtra.scala:99)
at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
error java.lang.NullPointerException


Reply to this email directly or view it on GitHub
#13 (comment)
.

@agemooij
Copy link
Author

Interesting. It was probably some fluke with a weird project state that caused the exceptions, although it might be a good idea to make sure you don't produce hard failures with nullpointer exceptions when files are not where you expect them to be.

As of this morning the problem is back to the one mentioned in issue #64, i.e. the results (single and aggregated) are incomplete and different every run.

@sksamuel
Copy link
Member

I'm still struggling to find out what is causing this, but I am
investigating.

On 27 November 2014 at 09:50, Age Mooij [email protected] wrote:

Interesting. It was probably some fluke with a weird project state that
caused the exceptions, although it might be a good idea to make sure you
don't produce hard failures with nullpointer exceptions when files are not
where you expect them to be.

As of this morning the problem is back to the one mentioned in issue #64
#64, i.e. the results
(single and aggregated) are incomplete and different every run.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel
Copy link
Member

Your stack trace was from this line

val index = IOUtils.readStreamAsString(getClass.getResourceAsStream("/scoverage/index.html"))

Which can't/shouldn't throw an NPE as that resource is in the
scoverage JAR. So something odd was going on in that run.

On 27 November 2014 at 09:53, Stephen Samuel (Sam) [email protected] wrote:

I'm still struggling to find out what is causing this, but I am
investigating.

On 27 November 2014 at 09:50, Age Mooij [email protected] wrote:

Interesting. It was probably some fluke with a weird project state that
caused the exceptions, although it might be a good idea to make sure you
don't produce hard failures with nullpointer exceptions when files are not
where you expect them to be.

As of this morning the problem is back to the one mentioned in issue #64
#64, i.e. the results
(single and aggregated) are incomplete and different every run.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel
Copy link
Member

@agemooij I might have asked this before but can you confirm, when you run coverage and the aggregated files change on each run - do the xml files give different results just by running the normal coverage without aggregation?

@agemooij
Copy link
Author

Yes they do, the coverage numbers are different every run, although from some experimentation they seem to converge on a specific outcome after about 3-5 runs (without cleaning in between).

Cleaning the build starts the process of convergence again and the converged coverage numbers are also different each time they converge. In other words, the numbers are very unreliable.

@sksamuel
Copy link
Member

The actual coverage AST stuff is sound, this is something to do with the
way it generates the measurement files that are then read back in. Perhaps
a race condition in a writer.

On 27 November 2014 at 11:08, Age Mooij [email protected] wrote:

Yes they do, the coverage numbers are different every run, although from
some experimentation they seem to converge on a specific outcome after
about 3-5 runs. Cleaning the build starts the process of convergence again
and the converged coverage numbers are also different each time they
converge. In other words, the numbers are very unreliable.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@sksamuel
Copy link
Member

Version 1.0.1 should address this issue.

@yanns
Copy link
Contributor

yanns commented Nov 28, 2014

I confirm the issue is fixed.
Thanks!!

@yanns
Copy link
Contributor

yanns commented Nov 28, 2014

On the HTML report, the links to the sources are broken because the sources are copied in the wrong location:
The sources are located in:
/home/simon/myproject/target/scala-2.11/scoverage-report/home/simon/myproject/moduleA/src/...
and should be in:
/home/simon/myproject/target/scala-2.11/scoverage-report/moduleA/src/...

@agemooij
Copy link
Author

I can verify that version 1.0.1 seems to have fixed both the missing aggregate report as also the weird and conflicting results.

I can also confirm that the aggregation task seems to have copied the entire path from the filesystem root all the way down to the module sources into the target/scala-2.11/scoverage-report/directory. I suspect a problem with relative vs absolute paths is to blame.

@massenz
Copy link

massenz commented Nov 28, 2014

1.0.1 fixes the aggregate issue.
To track the issue of the incorrect links, I've created a new [Issue #69]

@deepujain
Copy link

I have a maven project and not sbt, how do i get a aggregated scoverage report for my project that has multiple modules. I see that each individual module creates a scoverage.xml in its target directory.

Currently from top-level i run it as mvn clean test install scoverage:report -Dmaven.test.failure.ignore=true

@FelixReuthlingerBMW
Copy link

FelixReuthlingerBMW commented Oct 9, 2018

I was also wondering if there is any chance that the Maven plugin get updated with the aggregate feature, too?

--

Update: ok forget my question, found it myself:

true

https://github.com/scoverage/scoverage-maven-plugin#aggregated-reports-for-multi-module-projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests