Create a test base file

Description

A test base file contains a unique class that inherits from the MTF or XTR TestBase class. This class serves as the entry point for all the test cases, and all subsequent test cases or test fixtures should inherit from this class. This special class defines the global objects and variables that are available for use in all project test cases. It should contain at least the following two methods:

  • setUpClass method: This is a class-level setup method that is called once before the entire execution. This method serves as the initialization step. Within it, you set up the objects needed by subsequent test cases.

  • tearDownClass method This is a class-level teardown method that is called once after the entire execution. Its purpose is to perform any necessary cleanup that is shared across all test cases.

The test base is the appropriate place for global configuration settings, as its methods are called once during the entire execution. Below is the template ot the test base:

from mtf.mtf_base import MtfBase
from xtr import logging, TestCase

logger = logging.getLogger(__name__)


# This class methods will be called only once by the te-xtr.
class TestBase(TestCase, MtfBase):

    @classmethod
    def setUpClass(cls):
        logger.info("Message from TestBase setUpClass function")

    @classmethod
    def tearDownClass(cls):
        logger.info("Message from TestBase tearDownClass function")