How to use the toolium.config_files.ConfigFiles function in toolium

To help you get started, we’ve selected a few toolium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Telefonica / toolium / toolium / test_cases.py View on Github external
import logging
import sys
import unittest

from toolium.config_driver import get_error_message_from_exception
from toolium.config_files import ConfigFiles
from toolium.driver_wrappers_pool import DriverWrappersPool
from toolium.jira import change_all_jira_status
from toolium.pageelements import PageElement
from toolium.visual_test import VisualTest


class BasicTestCase(unittest.TestCase):
    """A class whose instances are api test cases."""
    config_files = ConfigFiles()
    driver_wrapper = None

    @classmethod
    def get_subclass_name(cls):
        return cls.__name__

    def get_method_name(self):
        # Split remove the test suffix added by ddt library
        return self._testMethodName.split('___')[0]

    def get_subclassmethod_name(self):
        return self.__class__.__name__ + "." + self.get_method_name()

    @classmethod
    def tearDownClass(cls):
        change_all_jira_status()
github Telefonica / toolium / toolium / driver_wrappers_pool.py View on Github external
def initialize_config_files(tc_config_files=None):
        """Initialize config files and update config files names with the environment

        :param tc_config_files: test case specific config files
        :returns: initialized config files object
        """
        # Initialize config files
        if tc_config_files is None:
            tc_config_files = ConfigFiles()

        # Update properties and log file names if an environment is configured
        env = DriverWrappersPool.get_configured_value('Config_environment', None, None)
        if env:
            # Update config properties filenames
            prop_filenames = tc_config_files.config_properties_filenames
            new_prop_filenames_list = prop_filenames.split(';') if prop_filenames else ['properties.cfg']
            base, ext = os.path.splitext(new_prop_filenames_list[0])
            new_prop_filenames_list.append('{}-{}{}'.format(env, base, ext))
            new_prop_filenames_list.append('local-{}-{}{}'.format(env, base, ext))
            tc_config_files.set_config_properties_filenames(*new_prop_filenames_list)

            # Update output log filename
            output_log_filename = tc_config_files.output_log_filename
            base, ext = os.path.splitext(output_log_filename) if output_log_filename else ('toolium', '.log')
            tc_config_files.set_output_log_filename('{}_{}{}'.format(base, env, ext))
github Telefonica / toolium / toolium / behave / environment.py View on Github external
"""Initialization method that will be executed before the test execution

    :param context: behave context
    """
    # Use pytest asserts if behave_pytest is installed
    install_pytest_asserts()

    # Get 'Config_environment' property from user input (e.g. -D Config_environment=ios)
    env = context.config.userdata.get('Config_environment')
    # Deprecated: Get 'env' property from user input (e.g. -D env=ios)
    env = env if env else context.config.userdata.get('env')
    if env:
        os.environ['Config_environment'] = env

    if not hasattr(context, 'config_files'):
        context.config_files = ConfigFiles()
    context.config_files = DriverWrappersPool.initialize_config_files(context.config_files)

    # By default config directory is located in environment path
    if not context.config_files.config_directory:
        context.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())

    context.global_status = {'test_passed': True}
    create_and_configure_wrapper(context)

    # Behave dynamic environment
    context.dyn_env = DynamicEnvironment(logger=context.logger)
github Telefonica / toolium / toolium / lettuce / terrain.py View on Github external
def setup_driver(scenario):
    """Scenario initialization

    :param scenario: running scenario
    """
    if not hasattr(world, 'config_files'):
        world.config_files = ConfigFiles()

    # By default config directory is located in terrain path
    if not world.config_files.config_directory:
        world.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())

    world.global_status = {'test_passed': True}
    bdd_common_before_scenario(world, scenario)
    world.reuse_driver = world.toolium_config.getboolean_optional('Driver', 'reuse_driver')
github Telefonica / toolium / toolium / lettuce / terrain.py View on Github external
def setup_driver(scenario):
    """Scenario initialization

    :param scenario: running scenario
    """
    if not hasattr(world, 'config_files'):
        world.config_files = ConfigFiles()

    # By default config directory is located in terrain path
    if not world.config_files.config_directory:
        world.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())

    world.global_status = {'test_passed': True}
    bdd_common_before_scenario(world, scenario)