Skip to content

Instantly share code, notes, and snippets.

@SnapperGee
Created September 7, 2020 20:48
Show Gist options
  • Save SnapperGee/e3885deceecae47b302a8773aec9195a to your computer and use it in GitHub Desktop.
Save SnapperGee/e3885deceecae47b302a8773aec9195a to your computer and use it in GitHub Desktop.
Gradle task that opens generated unit test summary results HTML page
/*
* This Gradle task assumes 2 things:
*
* 1.) The "open" command of the shell this task is executed in opens HTML files with a web browser.
* 2.) The name of the generated test report summary HTML page created by the Test task is set to its default name of "index.html".
*/
tasks.register("view-testreport", Exec)
{
dependsOn += test
shouldRunAfter test
group = 'View'
description = 'Opens unit test results summary HTML page in a web browser'
workingDir = test.reports.html.destination
executable = 'open'
args += 'index.html'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment