Package org.xwiki.test.ui
Class TestDebugger
- java.lang.Object
-
- org.junit.rules.TestWatcher
-
- org.xwiki.test.ui.TestDebugger
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class TestDebugger extends org.junit.rules.TestWatcher
Generates debugging information on test failure:- captures a screenshot of the browser window
- logs the URL of the current page
- logs the source of the current page
PageObjectSuite
, there's only a single file generated and it's only generated when all tests have finished executing. Thus if a test hangs there won't be any file generated and looking at the Jenkins UI it won't be possible to see which tests have executed.Normally each JUnit Test Runner knows what test is executing and when it's finished and thus can report them in its own console (as this is the case for IDEs for example). Again the issue here is that Jenkins doesn't have any JUnit Test Runner but instead is calling JUnit by delegation to the Maven Surefire plugin.
- Since:
- 4.3
- Version:
- $Id: 113fd89702dfca6ab833b73dc87675edd31de43f $
-
-
Constructor Summary
Constructors Constructor Description TestDebugger(org.openqa.selenium.WebDriver driver)
Creates a new test rule that generates debugging information on test failure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
failed(Throwable e, org.junit.runner.Description description)
protected void
starting(org.junit.runner.Description description)
protected void
succeeded(org.junit.runner.Description description)
void
takeScreenshot(String testName)
Captures a screenshot of the browser window.
-
-
-
Method Detail
-
starting
protected void starting(org.junit.runner.Description description)
- Overrides:
starting
in classorg.junit.rules.TestWatcher
-
succeeded
protected void succeeded(org.junit.runner.Description description)
- Overrides:
succeeded
in classorg.junit.rules.TestWatcher
-
failed
protected void failed(Throwable e, org.junit.runner.Description description)
- Overrides:
failed
in classorg.junit.rules.TestWatcher
-
takeScreenshot
public void takeScreenshot(String testName)
Captures a screenshot of the browser window.- Parameters:
testName
- the name of the file in which the screenshot will be taken. A ".png" suffix will be appended
-
-