Class NetworkExtensionClass

java.lang.Object
co.verisoft.fw.selenium.junit.extensions.networkExtension.NetworkExtensionClass
All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestExecutionExceptionHandler

@Deprecated public class NetworkExtensionClass extends Object implements org.junit.jupiter.api.extension.TestExecutionExceptionHandler, org.junit.jupiter.api.extension.BeforeTestExecutionCallback
Deprecated.
JUnit 5 extension that captures network requests and responses using Selenium's DevTools. This extension enables capturing network traffic during test execution and generates a report containing the details of the network requests and responses. The report is written to a JSON file.

It supports capturing network traffic per WebDriver instance and provides functionality to create network report files when a test fails.

The extension is configured through the NetworkExtension annotation, allowing the user to specify the number of network calls to capture.

  • Constructor Details

    • NetworkExtensionClass

      public NetworkExtensionClass()
      Deprecated.
  • Method Details

    • beforeTestExecution

      public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Deprecated.
      Callback method invoked before the test execution starts. It retrieves the number of network calls to capture based on the annotation configuration.
      Specified by:
      beforeTestExecution in interface org.junit.jupiter.api.extension.BeforeTestExecutionCallback
      Parameters:
      context - the test execution context
      Throws:
      Exception - if an error occurs during test setup
    • handleTestExecutionException

      public void handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext extensionContext, Throwable throwable) throws Throwable
      Deprecated.
      Callback method invoked when an exception occurs during test execution. It processes network requests and responses, generates the network report, and logs errors.
      Specified by:
      handleTestExecutionException in interface org.junit.jupiter.api.extension.TestExecutionExceptionHandler
      Parameters:
      extensionContext - the test execution context
      throwable - the exception thrown during test execution
      Throws:
      Throwable - rethrows the original exception