-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7babf69
commit 744db82
Showing
7 changed files
with
183 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
jdk: | ||
- oraclejdk8 | ||
- oraclejdk7 | ||
- openjdk6 | ||
|
||
script: | ||
- ./gradlew clean build |
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
39 changes: 36 additions & 3 deletions
39
src/main/groovy/com/blogspot/toomuchcoding/testprofiler/ReportMerger.groovy
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 |
---|---|---|
@@ -1,9 +1,42 @@ | ||
package com.blogspot.toomuchcoding.testprofiler | ||
|
||
import groovy.transform.PackageScope | ||
import groovy.transform.CompileStatic | ||
import groovy.transform.PackageScope | ||
import groovy.util.logging.Slf4j | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
@PackageScope | ||
@CompileStatic | ||
class ReportMerger { | ||
@Slf4j | ||
class ReportMerger extends DefaultTask { | ||
|
||
TestProfilerPluginExtension testProfilerPluginExtension | ||
@OutputDirectory File mergedTestProfilingSummaryDir | ||
|
||
@TaskAction | ||
void testsProfileSummaryReport() { | ||
getMergedTestProfilingSummaryDir().mkdirs() | ||
File mergedTestProfilingSummary = new File(getMergedTestProfilingSummaryDir(), getTestProfilerPluginExtension().mergedSummaryFileName) | ||
log.debug("Will store merged test profiling summary in [${mergedTestProfilingSummary}]") | ||
String fileContent = mergedTestProfilingSummary.text | ||
log.debug("Saving file [$mergedTestProfilingSummary] content [$fileContent]") | ||
mergedTestProfilingSummary.text = getTestProfilerPluginExtension().outputReportHeaders | ||
Set<ReportRow> reportRows = new TreeSet<ReportRow>(getTestProfilerPluginExtension().comparator as Comparator<ReportRow>) | ||
appendReportRow(fileContent, reportRows) | ||
mergedTestProfilingSummary << reportRows.collect(rowFromReport()).join('\n') | ||
println "Your combined report is available here [$mergedTestProfilingSummary]" | ||
} | ||
|
||
private void appendReportRow(String fileContent, Set<ReportRow> reportRows) { | ||
fileContent.split('\n').findAll { !it.contains(getTestProfilerPluginExtension().getOutputReportHeaders()) }.each { String string -> | ||
String[] row = string.split(getTestProfilerPluginExtension().separator) | ||
log.debug("Converting row $row") | ||
reportRows << new ReportRow(row[0], new TestExecutionResult(row[1], row[2], row[3] as Double), row[4] as Double) | ||
} | ||
} | ||
|
||
Closure<String> rowFromReport() { | ||
return getTestProfilerPluginExtension().rowFromReport.curry(getTestProfilerPluginExtension()) | ||
} | ||
} |
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
35 changes: 34 additions & 1 deletion
35
src/main/groovy/com/blogspot/toomuchcoding/testprofiler/TestProfilerPluginExtension.groovy
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 |
---|---|---|
@@ -1,15 +1,48 @@ | ||
package com.blogspot.toomuchcoding.testprofiler | ||
|
||
import groovy.transform.CompileStatic | ||
import groovy.transform.ToString | ||
|
||
@CompileStatic | ||
@ToString | ||
class TestProfilerPluginExtension { | ||
/** | ||
* Separator of columns in the output report | ||
*/ | ||
String separator = '\t' | ||
|
||
/** | ||
* Headers in the report | ||
*/ | ||
String outputReportHeaders = "module${separator}test class name${separator}test name${separator}test execution time in [s]${separator}test class execution time in [s]\n" | ||
|
||
/** | ||
* Closure that will be converted to a Comparator to compare row entries | ||
*/ | ||
Closure<Integer> comparator = DefaultTestExecutionComparator.DEFAULT_TEST_EXECUTION_COMPARATOR | ||
|
||
/** | ||
* Closure that converts a reporter row entry to a single String | ||
*/ | ||
Closure<String> rowFromReport = ReportStorer.DEFAULT_ROW_FROM_REPORT_CONVERTER | ||
|
||
/** | ||
* Base directory where reports will be gathered. The parent of this directory is build dir of the project | ||
*/ | ||
String reportOutputDir = "reports/test_profiling" | ||
|
||
/** | ||
* Filename of a single report | ||
*/ | ||
String reportOutputCsvFilename = "testsProfile.csv" | ||
String mergedSummaryDir = "build/reports/test_profiling" | ||
|
||
/** | ||
* Base directory where merged summary of reports will be kept. The parent of directory is the top root project dir | ||
*/ | ||
String mergedSummaryDir = "reports/test_profiling" | ||
|
||
/** | ||
* Filename of a merged summary of reports | ||
*/ | ||
String mergedSummaryFileName = "summary.csv" | ||
} |