byteblower_test_framework.report module

Reporting interfaces.

class byteblower_test_framework.report.ByteBlowerHtmlReport

Bases: ByteBlowerReport

Generate a report in HTML format.

Generates summary information of test status, test configuration and results from all flows.

This report contains:

  • A global PASS/FAIL result

  • Port configuration table

  • Correlated results

    • Aggregated results over all flows (supporting aggregation of over time graphs and summary table)

  • Per-flow results

    • Flow configuration

    • Results for all Analysers attached to the flow

__init__(output_dir: str | None = None, filename_prefix: str = 'byteblower', filename: str | None = None, layer2_speed: Layer2Speed | None = Layer2Speed.frame) None

Create a ByteBlower HTML report generator.

The report is stored under <output_dir>. The default structure of the file name is

<prefix>_<timestamp>.html

where:

  • <output_dir>: Configurable via output_dir. Defaults to the current working directory.

  • <prefix>: Configurable via filename_prefix

  • <timestamp>: Current time. Defined at construction time of the ByteBlowerReport Python object.

Parameters:
  • output_dir (str, optional) – Override the directory where the report file is stored, defaults to None (meaning that the “current directory” will be used)

  • filename_prefix (str, optional) – Prefix for the ByteBlower report file name, defaults to ‘byteblower’

  • filename (str, optional) – Override the complete filename of the report, defaults to None

  • layer2_speed (Layer2Speed, optional) – Configuration setting to select the layer 2 speed reporting, defaults to frame

add_flow(flow: Flow) None

Add the flow info.

Parameters:

flow (Flow) – Flow to add the information for

clear() None

Start with empty report contents.

render(api_version: str, framework_version: str, port_list: DataFrame, scenario_start_timestamp: datetime | None, scenario_end_timestamp: datetime | None) None

Render the report.

Parameters:

port_list (DataFrame) – Configuration of the ByteBlower Ports.

class byteblower_test_framework.report.ByteBlowerJsonReport

Bases: ByteBlowerReport

Generate report in JSON format.

Generates summary information of test status, test configuration and results from all flows.

This report contains:

  • Global test status

  • Port configuration (to-do)

  • Correlated results

    • Aggregated results over all flows (supporting aggregation of over time data (to-do) and summary data)

  • Per-flow results (to-do)

    • Flow configuration

    • Results for all Analysers attached to the flow

__init__(output_dir: str | None = None, filename_prefix: str = 'byteblower', filename: str | None = None) None

Create a ByteBlower JSON report generator.

The report is stored under <output_dir>. The default structure of the file name is

<prefix>_<timestamp>.json

where:

  • <output_dir>: Configurable via output_dir. Defaults to the current working directory.

  • <prefix>: Configurable via filename_prefix

  • <timestamp>: Current time. Defined at construction time of the ByteBlowerReport Python object.

Parameters:
  • output_dir (str, optional) – Override the directory where the report file is stored, defaults to None (meaning that the “current directory” will be used)

  • filename_prefix (str, optional) – Prefix for the ByteBlower report file name, defaults to ‘byteblower’

  • filename (str, optional) – Override the complete filename of the report, defaults to None

add_flow(flow: Flow) None

Add the flow info.

Parameters:

flow (Flow) – Flow to add the information for

clear() None

Start with empty report contents.

render(api_version: str, framework_version: str, port_list: DataFrame, scenario_start_timestamp: datetime | None, scenario_end_timestamp: datetime | None) None

Render the report.

Parameters:

port_list (DataFrame) – Configuration of the ByteBlower Ports.

class byteblower_test_framework.report.ByteBlowerReport

Bases: ABC

Abstract ByteBlower Report interface definition.

__init__(output_dir: str | None = None, filename_prefix: str = 'byteblower', filename: str | None = None) None

Create a ByteBlower report generator.

The report is stored under <output_dir>. The default structure of the file name is

<prefix>_<timestamp>.<ext>

where:

  • <output_dir>: Configurable via output_dir. Defaults to the current working directory.

  • <prefix>: Configurable via filename_prefix

  • <timestamp>: Current time. Defined at construction time of the ByteBlowerReport Python object.

  • <ext>: Output type specific file extension.

Parameters:
  • output_dir (str, optional) – Override the directory where the report file is stored, defaults to None (meaning that the “current directory” will be used)

  • filename (str, optional) – Override the complete filename of the report, defaults to None

  • filename_prefix (str, optional) – Prefix for the ByteBlower report file name, defaults to ‘byteblower’

abstract add_flow(flow: Flow) None

Add the flow info.

Parameters:

flow (Flow) – Flow to add the information for

abstract clear() None

Start with empty report contents.

abstract render(api_version: str, framework_version: str, port_list: DataFrame, scenario_start_timestamp: datetime | None, scenario_end_timestamp: datetime | None) None

Render the report.

Parameters:

port_list (DataFrame) – Configuration of the ByteBlower Ports.

property report_url: str

Return the name and location of the generated report.

Returns:

Name and location of the generated report.

Return type:

str

class byteblower_test_framework.report.ByteBlowerUnitTestReport

Bases: ByteBlowerReport

Generate test report in Unit XML format.

__init__(output_dir: str | None = None, filename_prefix: str = 'byteblower', filename: str | None = None) None

Create a ByteBlower Unit test report generator.

The report is stored under <output_dir>. The default structure of the file name is

<prefix>_<timestamp>.xml

where:

  • <output_dir>: Configurable via output_dir. Defaults to the current working directory.

  • <prefix>: Configurable via filename_prefix

  • <timestamp>: Current time. Defined at construction time of the ByteBlowerReport Python object.

Parameters:
  • output_dir (str, optional) – Override the directory where the report file is stored, defaults to None (meaning that the “current directory” will be used)

  • filename_prefix (str, optional) – Prefix for the ByteBlower report file name, defaults to ‘byteblower’

  • filename (str, optional) – Override the complete filename of the report, defaults to None

add_flow(flow: Flow) None

Add the flow info.

Parameters:

flow (Flow) – Flow to add the information for

clear() None

Start with empty report contents.

render(api_version: str, framework_version: str, port_list: DataFrame, scenario_start_timestamp: datetime | None, scenario_end_timestamp: datetime | None) None

Render the report.

Parameters:

port_list (DataFrame) – Configuration of the ByteBlower Ports.

class byteblower_test_framework.report.Layer2Speed

Bases: Enum

What will be included in the Layer 2 speed calculation.

frame = 'frame'

Frame without FCS.

  • Frame (as build and send by ByteBlower)

This way, each Frame gets 0 Bytes extra.

frame_with_fcs = 'frame_with_fcs'

Frame with FCS.

  • Frame (as build and send by ByteBlower)

  • FCS (CRC Frame Checksum, 4 Bytes)

This way, each Frame gets 4 Bytes extra.

physical = 'physical'

Frame with FCS and physical overhead.

  • Frame (as build and send by ByteBlower)

  • FCS (CRC Frame Checksum, 4 Bytes)

  • Preamble (7 Bytes)

  • SFD (Start Frame Delimiter, 1 Byte)

  • Pause (12 Bytes)

This way, each Frame gets 24 Bytes extra.

class byteblower_test_framework.report.UnitTestReport

Bases: object

Helper for generating JUnit XML test reports.

__init__() None

Construct a new helper.

add_fail(step: str, message: str, stdout: str | None = None) None

Add a failed test case.

Parameters:
  • step (str) – The step name (no spaces)

  • message (str) – The “fail” text

  • stdout (str | None) – The test standard output (log)

add_pass(step: str, message: str, stderr: str | None = None) None

Add a succeeded test case.

Parameters:
  • step (str) – The step name (no spaces)

  • message (str) – The “pass” text (== test standard output / log)

  • stdout – The test standard output (log)

add_skipped(step: str, message: str, stdout: str | None = None, stderr: str | None = None) None

Add a skipped test case.

Parameters:
  • step (str) – The step name (no spaces)

  • message (str) – The “skipped” text

  • stdout (str | None) – The test standard output (log)

  • stderr (str | None) – The test standard error (failure log)

save(name: str = 'report.xml') None

Write the JUnit XML file.

This file can then be processed by the CI/CD/CT tool.

Parameters:

name (str) – Name of the JUnit XML output file.

set_subtest(subtest: str) None

Start a new subtest; known as a test suite in JUnit XML.

Note

The previous subtest will be closed. When it did not contain any test cases, it won’t be added to the report.

Parameters:

subtest (str) – The subtest in the report