xtesting.core.unit module

Define the parent class to run unittest.TestSuite as TestCase.

class xtesting.core.unit.Suite(**kwargs)

Bases: xtesting.core.testcase.TestCase

Base model for running unittest.TestSuite.

generate_html(stream)

Generate html report from subunit stream

Raises:
CalledProcessError
classmethod generate_stats(stream)

Generate stats from subunit stream

Raises:
Exception
generate_xunit(stream)

Generate junit report from subunit stream

Raises:
Exception
run(**kwargs)

Run the test suite.

It allows running any unittest.TestSuite and getting its execution status.

By default, it runs the suite defined as instance attribute. It can be overriden by passing name as arg. It must conform with TestLoader.loadTestsFromName().

It sets the following attributes required to push the results to DB:

  • result,
  • start_time,
  • stop_time,
  • details.
Args:
kwargs: Arbitrary keyword arguments.
Return:
TestCase.EX_OK if any TestSuite has been run TestCase.EX_RUN_ERROR otherwise.