Esempio n. 1
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        result, output = Global.SUCCESS, ""

        if self._device._android_version == 'M':
            self._its_package_name = self._tc_parameters.get_param_value(
                "ITS_PACKAGE_M")
        elif self._device._android_version == 'N':
            self._its_package_name = self._tc_parameters.get_param_value(
                "ITS_PACKAGE_N")
        else:
            return Global.FAILURE, 'Unsupported Android Version'

        self._artifactory_uri = self._tc_parameters.get_param_value(
            "ARTIFACTORY_URI")
        self._test_timeout = self._tc_parameters.get_param_value(
            "TEST_TIMEOUT", default_cast_type=float)

        #self._scenes = ['scene0','scene1','scene2','scene3']
        self._scenes = ['scene0',
                        'scene1']  #TODO: Scenes 2 and 3 is not supported yet.
        self._tests = {}
        self.devnull = file(os.devnull, "w")
        return result, output
Esempio n. 2
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        result, output = Global.SUCCESS, ""

        # Retrieve artifact manager
        self._cts_path = os.path.join(
            Folders.ACS_CACHE, 'Artifacts',
            self._tc_parameters.get_param_value("CTS_LOCAL_PATH"))
        self._cts_media_path = self._tc_parameters.get_param_value(
            "CTS_MEDIA_PATH")
        self._cts_result_comparison = self._tc_parameters.get_param_value(
            "CTS_REPORT_COMPARISON_PATH")
        self._test_cmd_lines = self._tc_parameters.get_param_value(
            "TEST_CMD_LINES")
        self._test_timeout = self._tc_parameters.get_param_value(
            "TEST_TIMEOUT", default_cast_type=float)
        self._test_failed_retry_no = self._tc_parameters.get_param_value(
            "TEST_FAILED_RETRY_NO", default_value=0, default_cast_type=int)
        # Add a secondary report
        self.__tc_report = SecondaryTestReport(
            self._device.get_report_tree().get_report_path())
        self._cts_exec_path = ""

        return result, output
Esempio n. 3
0
 def initialize(self):
     """
     Process the **<Initialize>** section of the XML file and execute defined test steps.
     """
     UseCaseBase.initialize(self)
     result, output = Global.SUCCESS, ""
     os.environ['uiautomator_jars_path'] = os.path.normpath(
         os.path.join(Paths.TEST_SCRIPTS, "Lib", "PythonUiautomator"))
     return result, output
Esempio n. 4
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        result, output = Global.SUCCESS, ""

        self._cts_path = self._tc_parameters.get_param_value("CTS_PATH")
        self._cts_media_path = self._tc_parameters.get_param_value(
            "CTS_MEDIA_PATH")
        # Retrieve artifact manager
        self._artifact_manager = self._em.get_artifact_manager(
            "ARTIFACT_MANAGER")
        self._timeout = self._tc_parameters.get_param_value(
            param="DOWNLOAD_TIMEOUT",
            default_value=7000.0,
            default_cast_type=float)
        return result, output
Esempio n. 5
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        verdict, msg = Global.SUCCESS, ""

        # Export all ACS Global parameters as an JSON object into ACS_GLOBAL_PARAMETERS
        # environment variable so that user can access them from inside the
        # script that is being executed
        device_cfg_dict = self._global_conf.benchConfig.get_dict()
        dc_l = len(self._global_conf.deviceConfig)
        for x in range(1, dc_l + 1):
            device_cfg_dict['PHONE%s' % x] = self._global_conf.deviceConfig['PHONE%s' % x]
        device_cfg_dict['PHONE1']['serialNumber'] = self._device.retrieve_serial_number()
        device_cfg_dict["TC_PARAMETERS"] = self._tc_parameters.get_params_as_dict()
        os.environ['ACS_GLOBAL_PARAMETERS'] = json.dumps(device_cfg_dict)

        return verdict, msg
Esempio n. 6
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        result, output = Global.SUCCESS, ""

        self._cts_path = os.path.join(Folders.ACS_CACHE, 'Artifacts',
                                      self._tc_parameters.get_param_value("CTS_LOCAL_PATH"))
        if not os.path.exists(self._cts_path):
            return Global.FAILURE, "CTS path from CTS_LOCAL_PATH test case parameter is not valid: %s"%self._cts_path
        self._test_cmd_lines = self._tc_parameters.get_param_value("TEST_CMD_LINES")
        self._test_timeout = self._tc_parameters.get_param_value("TEST_TIMEOUT", default_cast_type=float)
        self._test_failed_retry_no = self._tc_parameters.get_param_value("TEST_FAILED_RETRY_NO",
                                                                         default_value=0, default_cast_type=int)
        self._cts_exec_path = ""
        self._cts_custom_plan_path = self._tc_parameters.get_param_value("CTS_CUSTOM_PLAN_LOCATION")

        return result, output
Esempio n. 7
0
    def initialize(self):
        UseCaseBase.initialize(self)
        self.case_name = self._tc_parameters.get_param_value(
            "TEST_CASE", default_cast_type=str)
        class_name = '.'.join(self.case_name.split(".")[:-1])
        method_name = self.case_name.split(".")[-1]
        #(class_name, method_name) = self.case_name.split("#")
        self.run_cmd = "exec bash %s run cts -c %s -m %s --disable-reboot" % (
            self.cts_tradefed, class_name, method_name)
        self.suite = mocksuite(self.case_name)
        self._instantlogger.initContext(self.suite,
                                        '%s.%s' % (class_name, method_name))

        self.case_timeout = self._tc_parameters.get_param_value(
            "TEST_TIMEOUT", default_cast_type=int)
        self._logger.info("Media instrument root: %s" %
                          self.media_instrument_root)
        self._logger.info("Case name: %s" % self.case_name)
        self._logger.info("Case timeout: %d" % self.case_timeout)
        self._logger.info("Run cmd: %s" % self.run_cmd)

        return Global.SUCCESS, "SUCCESS"
Esempio n. 8
0
    def initialize(self):
        """
        Process the **<Initialize>** section of the XML file and execute defined test steps.
        """
        UseCaseBase.initialize(self)
        result, output = Global.SUCCESS, ""

        # Test data that will be installed on the device
        self._test_data = {}
        self._rm_list = {}
        self._rm_list['REMOVE_BINARY'] = {}
        #########################
        # MANDATORY PARAMETERS  #
        #########################
        # Timeout definition for the test we are going to run
        # AKA "timeout" in ATF
        self._timeout = self._tc_parameters.get_param_value(
            param="TIMEOUT", default_value=0.0, default_cast_type=float)
        # Process name of the application to execute
        # AKA "test_script" in ATF
        self._process_name = self._tc_parameters.get_param_value(
            "PROCESS_NAME")

        #################
        # Optional ones #
        #################
        # AM parameters to start the test (within the process)
        # AKA "am_extra" in ATF
        self._am_extra = self._tc_parameters.get_param_value("AM_EXTRA",
                                                             default_value="")
        self.wifi_ap_name = self._device.get_config("WiFi_Connection_Ap_Name")
        self.wifi_ap_passwd = self._device.get_config("WiFi_Connection_Passwd")
        self.wifi_connection_test_page = self._device.get_config(
            "WiFi_Connection_TestPage")
        if self._am_extra:
            if self.wifi_ap_name and "Android Core QA" in self._am_extra:
                self._am_extra = self._am_extra.replace(
                    "Android Core QA", self.wifi_ap_name.strip(), 1)
            if self.wifi_ap_passwd and "AndroidQA" in self._am_extra:
                self._am_extra = self._am_extra.replace(
                    "AndroidQA", self.wifi_ap_passwd.strip(), 1)
            if self.wifi_connection_test_page and "www.google.ro" in self._am_extra:
                self._am_extra = self._am_extra.replace(
                    "www.google.ro", self.wifi_connection_test_page.strip(), 1)
        # APKs to be installed, may be split by ";"
        # AKA "apks" in ATF
        self._apks = self._tc_parameters.get_param_value("APKS")

        # TODO: put those features in the fwk
        # Reboot the board before executing the test
        # AKA "PRE_REBOOT" in ATF
        self._pre_reboot_device = False
        self._post_reboot_device = False
        self._post_reboot_nok_device = False
        self._disable_tc_reboot = self._device.get_config(
            "disableTcReboot", False, default_cast_type='str_to_bool')
        if not self._disable_tc_reboot:
            self._pre_reboot_device = self._tc_parameters.get_param_value(
                "PRE_REBOOT",
                default_value="False",
                default_cast_type="str_to_bool")
            # Reboot the board after test execution
            # AKA "POST_REBOOT" in ATF
            self._post_reboot_device = self._tc_parameters.get_param_value(
                "POST_REBOOT",
                default_value="False",
                default_cast_type="str_to_bool")
            # Reboot the board after test execution if test verdict is failure
            # AKA "POST_REBOOT_NOK" in ATF
            self._post_reboot_nok_device = self._tc_parameters.get_param_value(
                "POST_REBOOT_NOK",
                default_value="False",
                default_cast_type="str_to_bool")
        # Test file to be deployed on the target, may be split by ";"
        # AKA "media_file" in ATF
        self._test_files = self._tc_parameters.get_param_value("TEST_FILES")
        # Destination of test file on the device, may be split by ";" and must contain
        # as much as destination than test files
        # AKA "adb_destination" in ATF
        self._test_files_dest = self._tc_parameters.get_param_value(
            "TEST_FILES_DEST")
        # Set some properties on the device, if needed, may be split by ";"
        # AKA "set_prop" in ATF
        self._set_props = self._tc_parameters.get_param_value("SET_PROPS")
        # Retrieve data from the device after test, and put it in the report
        # AKA "retrieve_artefacts" in ATF
        self._retrieve_artifact = self._tc_parameters.get_param_value(
            "RETRIEVE_ARTIFACT")
        # Result of run test method
        self._run_test_result = Global.SUCCESS

        # TODO: Handle these parameters in that TC or in the fwk to install specific test bin/apk of that test
        # AKA "binaries" in ATF
        self._binary_files = self._tc_parameters.get_param_value("BINARY")
        # Remove at the setup time the BINARY file available on the device
        # and restore back at the end of the test
        # AKA "rm_pkg" in ATF
        self._remove_binary_files = self._tc_parameters.get_param_value(
            "REMOVE_BINARY")
        self._pre_factory_reset_device = self._tc_parameters.get_param_value(
            "PRE_TEST_FACTORY_RESET",
            default_value="False",
            default_cast_type="str_to_bool")
        # Retrieve artifact manager
        self._artifact_manager = self._em.get_artifact_manager(
            "ARTIFACT_MANAGER")

        return result, output