Example #1
0
    def __init__(self, suite_datetime="", user="", station="", program="", program_date=time.strftime("01/01/1980 12:00:00"), version="", release="", database="", issue="", execution_id="", country="", folder="", test_type="TIR"):
        self.timestamp = time.strftime("%Y%m%d%H%M%S")

        self.user = user
        self.station = station
        self.program = program
        self.program_date = program_date
        self.version = version
        self.release = release
        self.database = database
        self.initial_time = datetime.today()
        self.seconds = 0
        self.suite_datetime = suite_datetime

        self.table_rows = []
        self.test_case_log = []
        self.csv_log = []
        self.invalid_fields = []
        self.table_rows.append(self.generate_header())
        self.folder = folder
        self.test_type = test_type
        self.issue = issue
        self.execution_id = execution_id
        self.country = country
        self.config = ConfigLoader()
Example #2
0
    def __init__(self, config_path=""):
        """
        Definition of each global variable:

        base_container: A variable to contain the layer element to be used on all methods.

        errors: A list that contains every error that should be sent to log at the end of the execution.

        language: Contains the terms defined in the language defined in config or found in the page.

        log: Object that controls the logs of the entire application.

        log.station: Property of the log that contains the machine's hostname.

        log_file: A variable to control when to generate a log file of each execution of web_scrap. (Debug purposes)

        wait: The global Selenium Wait defined to be used in the entire application.
        """
        if config_path == "":
            config_path = os.path.join(sys.path[0], r"config.json")
        self.config = ConfigLoader(config_path)

        if self.config.browser.lower() == "firefox":
            driver_path = os.path.join(os.path.dirname(__file__),
                                       r'drivers\\geckodriver.exe')
            log_path = os.path.join(os.path.dirname(__file__),
                                    r'geckodriver.log')
            options = FirefoxOpt()
            options.set_headless(self.config.headless)
            self.driver = webdriver.Firefox(firefox_options=options,
                                            executable_path=driver_path,
                                            log_path=log_path)
        elif self.config.browser.lower() == "chrome":
            driver_path = os.path.join(os.path.dirname(__file__),
                                       r'drivers\\chromedriver.exe')
            options = ChromeOpt()
            options.set_headless(self.config.headless)
            self.driver = webdriver.Chrome(chrome_options=options,
                                           executable_path=driver_path)

        self.driver.maximize_window()
        self.driver.get(self.config.url)

        #Global Variables:

        self.wait = WebDriverWait(self.driver, 5)

        self.language = LanguagePack(
            self.config.language) if self.config.language else ""
        self.log = Log(folder=self.config.log_folder)
        self.log.station = socket.gethostname()

        self.base_container = "body"
        self.errors = []
        self.config.log_file = False
Example #3
0
    def __init__(self, config_path=""):

        Base.__init__(self, config_path)
        self.config = ConfigLoader(config_path)

        self.tries = 1
        self.IdRet = ''
        self.gridValues = []

        # Variável importada da classe Webapp
        # Variable imported from the Webapp class
        self.lineGrid = 0
Example #4
0
    def __init__(self, config_path="", autostart=True):
        """
        Definition of each global variable:

        base_container: A variable to contain the layer element to be used on all methods.

        errors: A list that contains every error that should be sent to log at the end of the execution.

        language: Contains the terms defined in the language defined in config or found in the page.

        log: Object that controls the logs of the entire application.

        log.station: Property of the log that contains the machine's hostname.

        log_file: A variable to control when to generate a log file of each execution of web_scrap. (Debug purposes)

        wait: The global Selenium Wait defined to be used in the entire application.
        """
        #Global Variables:

        if config_path == "":
            config_path = os.path.join(sys.path[0], r"config.json")
        self.config = ConfigLoader(config_path)
        self.config.autostart = autostart

        self.language = LanguagePack(
            self.config.language) if self.config.language else ""
        self.log = Log(folder=self.config.log_folder)
        self.log.station = socket.gethostname()
        self.test_case = []
        self.last_test_case = None
        self.message = ""
        self.expected = True

        try:
            self.log.user = os.getlogin()
        except Exception:
            import getpass
            self.log.user = getpass.getuser()

        self.base_container = "body"
        self.errors = []
        self.config.log_file = False
        self.tmenu_out_iframe = False

        if autostart:
            self.Start()
Example #5
0
File: log.py Project: Doh-Tec/tir
    def __init__(self, suite_datetime="", user="", station="", program="", program_date=time.strftime("01/01/1980 12:00:00"), version="", release="", database="", issue="", execution_id="", country="", folder="", test_type="TIR"):
        self.timestamp = time.strftime("%Y%m%d%H%M%S")

        today = datetime.today()

        config_path = os.path.join(sys.path[0], r"config.json")
        self.config = ConfigLoader(config_path)
        self.user = user
        self.station = station
        self.program = program
        self.program_date = program_date
        self.version = version
        self.release = release
        self.database = database
        self.initial_time = datetime.today()
        self.testcase_initial_time = datetime.today()
        self.seconds = 0
        self.testcase_seconds = 0
        self.suite_datetime = suite_datetime

        self.table_rows = []
        self.test_case_log = []
        self.csv_log = []
        self.invalid_fields = []
        self.table_rows.append(self.generate_header())
        self.folder = folder
        self.test_type = test_type
        self.issue = self.config.issue
        self.execution_id = self.config.execution_id
        self.country = country
        self.start_time = None
        self.end_time = None
        self.ct_method = ""
        self.ct_number = ""
        self.so_type = platform.system()
        self.so_version = f"{self.so_type} {platform.release()}"
        self.build_version = ""
        self.lib_version = ""
        self.webapp_version = ""
        self.date = today.strftime('%Y%m%d')
        self.hour = today.strftime('%H:%M:%S')
        self.last_exec = today.strftime('%Y%m%d%H%M%S%f')[:-3]
        self.hash_exec = ""
        self.test_case = self.list_of_testcases()
        self.finish_testcase = []
Example #6
0
import logging
from logging.config import dictConfig
from tir.technologies.core.config import ConfigLoader
from datetime import datetime
from pathlib import Path
import os
import socket
import inspect

config = ConfigLoader()

filename = None
folder = None


def logger(logger='root'):
    """
    :return:
    """

    global filename
    global folder

    today = datetime.today()

    if not filename:
        filename = f"TIR_{get_file_name('testsuite')}_{today.strftime('%Y%m%d%H%M%S%f')[:-3]}.log"

        folder = create_folder()

    if config.smart_test or config.debug_log:
Example #7
0
    def __init__(self):

        self.config = ConfigLoader()
Example #8
0
 def __init__(self, config_path="", autostart=True):
     self.__webapp = WebappInternal(config_path, autostart)
     self.__database = BaseDatabase()
     self.config = ConfigLoader()
     self.coverage = self.config.coverage