Class HarRecorder

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    @GlobalRule
    public class HarRecorder
    extends org.junit.rules.TestWatcher
    The system property RECORD_BROWSER_TRAFFIC can be set to either off, failuresOnly or always to control when browser traffic should be recorded when launching tests. Traffic is recorded as a HAR (HAR file format) file based on all network interactions between the browser and the Jenkins instance and then add it as JUnit attachment to the test result.
    • Method Detail

      • getProxy

        public static com.browserup.bup.BrowserUpProxy getProxy​(InetAddress networkAddress,
                                                                String testName)
        Create a proxy to record the HAR listening on the specified address
        Parameters:
        networkAddress - the specific address to bind to, or null to bind on all addresses
      • isCaptureHarEnabled

        public static boolean isCaptureHarEnabled()
      • succeeded

        protected void succeeded​(org.junit.runner.Description description)
        Overrides:
        succeeded in class org.junit.rules.TestWatcher
      • failed

        protected void failed​(Throwable e,
                              org.junit.runner.Description description)
        Overrides:
        failed in class org.junit.rules.TestWatcher
      • starting

        protected void starting​(org.junit.runner.Description description)
        Overrides:
        starting in class org.junit.rules.TestWatcher