forked from timurstrekalov/saga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at generating cobertura-style output
Adding a "sourceDir" property in the mojo to allow us to generate Cobertura reports with proper source pointers. Adding the ability to define multiple source directories to be listed in Cobertura report output.
- Loading branch information
Stanton Sievers
committed
Sep 18, 2013
1 parent
dac9291
commit 75a15fc
Showing
15 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
saga-core/src/main/java/com/github/timurstrekalov/saga/core/reporter/CoberturaReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.timurstrekalov.saga.core.reporter; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import com.github.timurstrekalov.saga.core.ReportFormat; | ||
import com.github.timurstrekalov.saga.core.model.TestRunCoverageStatistics; | ||
|
||
public class CoberturaReporter extends AbstractStringTemplateBasedReporter { | ||
|
||
public CoberturaReporter() { | ||
super(ReportFormat.COBERTURA); | ||
} | ||
|
||
@Override | ||
protected void writeReportThreadSafe(final File outputFile, final TestRunCoverageStatistics runStats) throws IOException { | ||
stringTemplateGroup.getInstanceOf("runStatsCobertura") | ||
.add("stats", runStats) | ||
.add("name", config.getProperty("app.name")) | ||
.add("version", config.getProperty("app.version")) | ||
.add("url", config.getProperty("app.url")) | ||
.write(outputFile, listener); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
saga-core/src/main/resources/stringTemplates/classStatsCobertura.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
classStatsCobertura(fileStats) ::= << | ||
<class name="$fileStats.fileName$" filename="$fileStats.relativeName$" line-rate="$fileStats.coverageRate$" branch-rate="0.0" complexity="0"> | ||
<methods /> | ||
<lines> | ||
$fileStats.executableLineCoverageRecords:lineCoverageDataCobertura(); separator="\n"$ | ||
</lines> | ||
</class> | ||
>> |
3 changes: 3 additions & 0 deletions
3
saga-core/src/main/resources/stringTemplates/lineCoverageDataCobertura.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lineCoverageDataCobertura(lineStats) ::= << | ||
<line number="$lineStats.lineNr$" hits="$lineStats.timesExecuted$" branch="false"/> | ||
>> |
7 changes: 7 additions & 0 deletions
7
saga-core/src/main/resources/stringTemplates/packageStatsCobertura.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
packageStatsCobertura(fileStats) ::= << | ||
<package name="$fileStats.relativeName$" line-rate="0.0" branch-rate="0.0" complexity="0"> | ||
<classes> | ||
</classes> | ||
</package> | ||
|
||
>> |
18 changes: 18 additions & 0 deletions
18
saga-core/src/main/resources/stringTemplates/runStatsCobertura.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
runStatsCobertura(stats, name, version, url) ::= << | ||
<?xml version="1.0" ?> | ||
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'> | ||
<!-- Generated using $name$ ($url$) version $version$ --> | ||
<coverage branch-rate="0.0" branches-covered="0" branches-valid="0" complexity="0" line-rate="$stats.totalCoverageRate$" lines-valid="$stats.totalStatements$" lines-covered="$stats.totalExecuted$" timestamp="1376875707" version="1.9"> | ||
<sources> | ||
$stats.sourceDirs:sourceDirsCobertura(); separator="\n"$ | ||
</sources> | ||
<packages> | ||
<package name="default" line-rate="0.0" branch-rate="0.0" complexity="0"> | ||
<classes> | ||
$stats.fileStatsWithSeparateFileOnly:classStatsCobertura(); separator="\n"$ | ||
</classes> | ||
</package> | ||
</packages> | ||
</coverage> | ||
>> |
3 changes: 3 additions & 0 deletions
3
saga-core/src/main/resources/stringTemplates/sourceDirsCobertura.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sourceDirsCobertura(sourceDir) ::= << | ||
<source>$sourceDir$</source> | ||
>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters