[x3d-public] JaCoCo - please install in java/build.xml for X3DJSAIL

John Carlson yottzumm at gmail.com
Mon Feb 11 04:27:16 PST 2019


Don, I’d love to add jacoco myself, if you can suggest a place that doesn’t interfere with you on the sourceforge file system.

I would like to generate top down and bottom up (at the same time) XML.  Thus we will take all the Java generated from the X3dToJava.xslt generated POJOs and run it through a coverage tool on all our source code to figure out what constructors and methods aren’t called.   Then we will pick methods that haven’t been called and generate an XML snippet out of it, then we step up the schema (I’m assuming we’ve got the right data structure for this) and choose more methods that haven’t been called.  Ultimately, we will get to a place where the methods are called by the coverage tool  (let’s call this dangling nodes).   We will zoom up the schema at that point to reach the root.   We will need some way to patch together the various branches.  Hmm.  I found this:

https://ieeexplore.ieee.org/document/8285209  It looks like these guys have done it.  Hmm.  Maybe someone can get these guys to help.  Would it be smart to talk to a German about talking to an Austrian?  Research is fairly recent.

I think that JaCoCo is more like a typical performance tool, rather than AspectJ, which weaves byte codehttps://www.google.com/search?q=does+jacoco+modify+source+code&oq=does+jacoco+modify+source+code&aqs=chrome..69i57.13839j0j8&sourceid=chrome&ie=UTF-8  says it works on byte code.  JaCoCo has problems with interfaces, but we can likely block out those packages.

I would create a single test case in Java which includes all ~4000 Java test cases, and trust the garbage collector (or test for memory leaks).   So I would likely create something that calls CommandLine:: from Java 4000 times one for each source file in the same JVM instance.  The method might get a bit big, so I would break the code into pieces by hand.

I think it can be run from the command line too, but I thought you would prefer

If you would like to use the Ontology instead of a Java reflection, Schema or Object Model, that would be cool.

So I think the next step is to figure out where to add covered Java.   Ajv reports problem tests and XPath, so once we get to the top of the fragmented document, we can run the document through the Ajv validator to get reports of “missing object” “missing property” or “missing value” we add missing items to our leaf data structure.  And repeat finding a branch.

There’s a problem here, but I haven’t quite identified it.  I think we want to find all siblings in the schema. And if we pick USE, we need to find the DEF.

I’m still a couple of years behind the research.   Hmm.  Maybe I need to apply myself to the books a bit more.

“Reverse Pruning”

John

Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Sunday, February 10, 2019 12:45 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: JaCoCo - please install in java/build.xml for X3DJSAIL

Thanks for the good idea, and for explaining your goals.

Found some interesting references:

[1] An Introduction to Code Coverage.  In this article, you'll learn how to get started with code coverage, how to find the right tool, how to calculate it, and what percentage you should aim for.
     by Sten Pittet · May. 24, 17 · DZone Java Zone · Tutorial
     https://dzone.com/articles/an-introduction-to-code-coverage

[2] Wikipedia: Java code coverage tools
     https://en.wikipedia.org/wiki/Java_code_coverage_tools

[3] JCov. The JCov open source project is used to gather quality metrics associated with the production of test suites. JCov is being opened in order to facilitate the practice of verifying test execution of regression tests in OpenJDK development.
     https://wiki.openjdk.java.net/display/CodeTools/jcov

[4] JaCoCo versus JCov
     https://java.libhunt.com/compare-jacoco-vs-jcov

[4] JaCoCo API Usage Examples
     https://www.jacoco.org/jacoco/trunk/doc/api.html

Two questions please.

=====================

a. Can JaCoCo be run independent of the current build, or is it inserting code in source?  In other words, can you run it without modifying X3DJSAIL source?  Not clear from initial read of JaCoCo docs.

I think it might work by modifying already-compiled bytecode in X3DJSAIL .jar file, since it uses the ASM library. https://asm.ow2.io

... in which case it probably doesn't require changing X3DJSAIL source?

... in which case you can build and run JaCoCo together with X3DJSAIL yourself, not requiring modifications to source code?

=====================

b. Usually code coverage is performed against a test suite.  We only have a few unit tests, associated with types.

https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/src/org/web3d/x3d/tests/

	FieldObjectTests.java

I just made sure that package tree (and specific source file) is included in both X3DJSAIL .jar files, and will be included in tonight's release.  (Still having trouble getting it to show up in Javadoc however.)

As you know, most unit testing occurs through processing of ~4000 scenes in X3D Examples Archives

	http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

And so, should we talk about what kind of unit tests you want to develop?

=====================

Thanks, Don


On 2/9/2019 8:31 PM, John Carlson wrote:
> I need to get data from jacoco, and put it into a program to create test cases using the uncovered cases. We will repeat finding test cases until all uncovered cases are covered using my secret algorithm to build test cases.  I will later attempt to create the main data structure in my secret algorithm which I can use to traverse the X3DUOM or (a future) X3DJSAIL.  If you want to see my algorithm, maybe wait for the next Web3D conference and I’ll give a presentation on generating Java test cases for X3D testing and repeating. Yay!  How else do you do it?  The results should be X3D XML files for testing I hope. Just a few to cover most of the use cases.
> 
> I hope I don’t crash and burn.   This has been a few good days.   Prayers please.
> 
> Thanks,
> 
> John
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *John Carlson <mailto:yottzumm at gmail.com>
> *Sent: *Saturday, February 9, 2019 9:51 PM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>; X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *JaCoCo - please install in java/build.xml for X3DJSAIL
> 
> Please install JaCoCo in www.web3d.org/x3d/stylesheets/Java/build.xml <http://www.web3d.org/x3d/stylesheets/Java/build.xml> and create a Local Java application that JaCoCo finds test coverage off that include all Java X3DJSAIL client files. I can do this once JaCoCo is installed in the source tree (tools?).
> 
> Ant file examples here: https://www.jacoco.org/jacoco/trunk/doc/ (not sure if these work or not).
> 
> JaCoCo is a code coverage tool. I need it to find untested constructor and methods (but don’t record for interfaces).
> 
> Here’s the Eclipse public license and various licenses for JaCoCo libraries: https://www.jacoco.org/license.html (can be used in Eclipse. We are using it in ant).
> 
> Thanks,
> 
> John
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190211/b35a4e05/attachment-0001.html>


More information about the x3d-public mailing list