Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code coverage of generated Java code
Code coverage of generated Java code [message #1818659] Sun, 22 December 2019 14:47 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi
As detailed here https://www.dietrich-it.de/xtext/2016/01/12/code-coverage-for-xtend.html with this setting of the xtend-maven-plugin, <xtendAsPrimaryDebugSource>true</xtendAsPrimaryDebugSource>, you get JaCoCo code coverage of the original Xtend sources. It does not work in Eclipse with Eclemma, but it does work in JaCoCo reports, both HTML, and XML (indeed related tools like Coveralls and SonarQube also correctly refer to the original Xtend sources in their code coverage statistics, by relying on the reports generated by JaCoCo).
But what about code coverage of Java code generated for your own Xbase DSL? The xtext-maven-plugin seems to have a similar output configuration parameter, installDslAsPrimarySource, but setting it to true does not seem to make any difference: JaCoCo reports always show the generated Java file. Am I missing something?
Thanks in advance
Lorenzo


Re: Code coverage of generated Java code [message #1818663 is a reply to message #1818659] Sun, 22 December 2019 16:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13666
Registered: July 2009
Senior Member
did you compare the generated .class files for differences?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code coverage of generated Java code [message #1818664 is a reply to message #1818663] Sun, 22 December 2019 17:08 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
I've just checked and with and without installDslAsPrimarySource the .class files are just the same... thus I assume there's something wrong...

Re: Code coverage of generated Java code [message #1818665 is a reply to message #1818664] Sun, 22 December 2019 17:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13666
Registered: July 2009
Senior Member
maybe you can debug around
org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/TraceAsPrimarySourceInstaller.java


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code coverage of generated Java code [message #1818666 is a reply to message #1818665] Sun, 22 December 2019 17:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13666
Registered: July 2009
Senior Member
p.s: it might also be that this feature is not implemented at all
i can find

DebugSourceInstallingCompilationParticipant / AbstractXtendInstallDebugInfoMojo only


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code coverage of generated Java code [message #1818672 is a reply to message #1818666] Sun, 22 December 2019 19:48 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
Indeed, I don't think that's implemented at all... by debugging the Maven build, OutputConfiguration.setInstallDslAsPrimarySource is called (with true), but isInstallDslAsPrimarySource is never called. I'll file an issue and try to provide a PR taking inspiration from AbstractXtendInstallDebugInfoMojo, what do you think?

Re: Code coverage of generated Java code [message #1818678 is a reply to message #1818672] Sun, 22 December 2019 20:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13666
Registered: July 2009
Senior Member
yes that should be doable

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Newbie Q.] Grammar Failing: Element: -UNKNOWN-
Next Topic:Xtext Beginner Scoping/Referencing Problem
Goto Forum:
  


Current Time: Wed Dec 02 13:06:00 GMT 2020

Powered by FUDForum. Page generated in 0.02229 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top