Skip to content

Instantly share code, notes, and snippets.

@Artur-
Last active August 29, 2015 14:22
Show Gist options
  • Save Artur-/e5e4b23d6dcd53c90072 to your computer and use it in GitHub Desktop.
Save Artur-/e5e4b23d6dcd53c90072 to your computer and use it in GitHub Desktop.
Open test for Gerrit change
var hostname="172.16.11.253";
var changeId=document.evaluate("//a[contains(@title,'Reload the change')]",document.body).iterateNext().innerText;
var patchSet = document.body.innerText.match("Patch Sets \\(\\d+/(\\d+)\\)")[1];
var testClass;
try {
var file = document.evaluate("//td[text()='A']/..//a[contains(text(),'Test.java')]",document.body).iterateNext().innerText;
var start = file.lastIndexOf("/")+1;
var end = file.lastIndexOf("Test.java");
testClass = file.substring(start,end);
} catch (e) {
testClass = window.prompt("Test name");
}
if (testClass) {
var testUrl = "http://"+hostname+":8080/test-"+changeId+"-"+patchSet+"/run/"+testClass+"?restartApplication&debug";
window.open(testUrl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment