This is an automated email from the git hooks/post-receive script. sylvestre pushed a commit to branch master in repository jscover.
commit f9d92f5f760a062d3cec3f6c7e8f737ca276bc7a Author: tntim96 <[email protected]> Date: Sat Jun 7 20:06:50 2014 +1000 Use shutdown hook in last acceptance test --- .../java/jscover/ui/HtmlUnitUITest.java | 47 ++++++++++++++-------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/test-acceptance/java/jscover/ui/HtmlUnitUITest.java b/src/test-acceptance/java/jscover/ui/HtmlUnitUITest.java index 503bbb5..02d37af 100644 --- a/src/test-acceptance/java/jscover/ui/HtmlUnitUITest.java +++ b/src/test-acceptance/java/jscover/ui/HtmlUnitUITest.java @@ -346,11 +346,14 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlTableRow; import jscover.Main; +import jscover.util.IoUtils; import jscover.util.ReflectionUtils; import org.apache.commons.io.FileUtils; import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -364,6 +367,7 @@ import static org.junit.Assert.assertThat; public class HtmlUnitUITest { private static Thread server; + private static Main main = new Main(); private static HTMLCoverageData scriptA = new HTMLCoverageData("/scripts/script-a.js", "33%", "0%", "33%"); private static HTMLCoverageData scriptB = new HTMLCoverageData("/scripts/script-b.js", "50%", "0%", "66%"); private static HTMLCoverageData scriptC = new HTMLCoverageData("/scripts/script-c.js", "72%", "25%", "100%"); @@ -380,11 +384,11 @@ public class HtmlUnitUITest { data.add(scriptEmpty); data.add(scriptLine); } + private static File reportDir = new File("target/UI-testing"); private WebClient webClient = new WebClient(); - private File reportDir = new File("target/UI-testing"); - protected String[] args = new String[]{ + protected static String[] args = new String[]{ "-ws", "--document-root=src/test-acceptance/resources/jscover/ui", "--port=9001", @@ -392,26 +396,35 @@ public class HtmlUnitUITest { "--report-dir=" + reportDir }; + @BeforeClass + public static void setUpOnce() throws IOException { + FileUtils.deleteDirectory(reportDir); + server = new Thread(new Runnable() { + public void run() { + try { + main.runMain(args); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + server.start(); + storeResult(); + } + + @AfterClass + public static void tearDown() { + main.stop(); + } + @Before public void setUp() throws IOException { - if (server == null) { - FileUtils.deleteDirectory(reportDir); - server = new Thread(new Runnable() { - public void run() { - try { - Main.main(args); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }); - server.start(); - storeResult(); - } webClient.getOptions().setTimeout(1000); } - private void storeResult() throws IOException { + private static void storeResult() throws IOException { + WebClient webClient = new WebClient(); + webClient.getOptions().setTimeout(1000); HtmlPage page = webClient.getPage("http://localhost:9001/jscoverage.html?index.html"); page.getHtmlElementById("storeTab").click(); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jscover.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

