module documentation
Helpers to compile Java and run unit tests with coverage.
| Function | class |
Converts a path relative to root directory to a class name. |
| Function | compile |
A default java compilation command. Kept simple. If you need a more elaborate setup, it is easy enough to write your own, rather than this function being extremely configurable and configure it. |
| Function | jacoco |
Creates a coverage report from the output of jacocoRunJunit4. |
| Function | jacoco |
Runs junit4 tests with the default JunitCore class. |
| Constant | _PATHSEP |
Undocumented |
Converts a path relative to root directory to a class name.
For example if classpathEntry is build/test and the p is build/test/my/package/Dodo.class, the result is my.package.Dodo.
| Parameters | |
classpathPath | a directory containing compiled classes |
p:Path | a *.class file within classpathEntry |
| Returns | |
str | Undocumented |
A default java compilation command. Kept simple. If you need a more elaborate setup, it is easy enough to write your own, rather than this function being extremely configurable and configure it.
| Parameters | |
targetos.PathLike | a Path where to drop the compiled files |
srcos.PathLike | the source files directory |
*classpath:Path | classpath members |
def jacocoReport(targetPath:
Path, jacocoCli: Path, jacocoData: Path, classFiles: Path, sourceFiles: Path):
¶
Creates a coverage report from the output of jacocoRunJunit4.
| Parameters | |
targetPath | the directory where to place the coverage html files |
jacocoPath | the jar org.jacoco.cli...jar. |
jacocoPath | the output of jacocoRunJunit4 |
classPath | the compiled classes classpath |
sourcePath | directory with the source files |
def jacocoRunJunit4(targetPath:
Path, testClassesPath: Path, testClassRe: str | re.Pattern, jacocoJar: Path, *classpath: Path):
¶
Runs junit4 tests with the default JunitCore class.
| Parameters | |
targetPath | the path of the coverage data to produce by running with jacoco |
testPath | a Path representing a classpath entry for test classes |
teststr | re.Pattern | a regular expression or compiled pattern which has to be matched by *.class files on the testClassesPath to be included as a test class. Classes with a $ in the name are always excluded. If there are no helper classses on the classpath, just use ., otherwise, depending on your convention, ^Test.* or .*Test[.]class$ may be what you need. Only the file name, without any leading path name, will be searched with the pattern. |
jacocoPath | the jar org.jacoco.agent...jar, not going on the class path |
*classpath:Path | further classpath entries, i.e. classes, junit jar, etc. |