Esempio n. 1
0
    def tearDown(self):
        # pylint: disable=no-member

        # Kill processes
        Tns.kill()
        AppiumDriver.kill()
        Gradle.kill()
        Process.kill_all_in_context()
        TnsTest.restore_files()

        # Get outcome
        if hasattr(self, '_outcome'):  # Python 3.4+
            result = self.defaultTestResult()  # these 2 methods have no side effects
            self._feedErrorsToResult(result, self._outcome.errors)
        else:  # Python 3.2 - 3.3 or 3.0 - 3.1 and 2.7
            result = getattr(self, '_outcomeForDoCleanups', self._resultForDoCleanups)

        # Take screen on test fail
        if result.errors or result.failures:
            self.get_screenshots()
            self.archive_apps()
            outcome = 'FAILED'
        else:
            outcome = 'PASSED'
        Log.test_end(test_name=TestContext.TEST_NAME, outcome=outcome)
    def tearDown(self):
        # pylint: disable=no-member

        # Kill processes
        Tns.kill()
        Gradle.kill()
        Process.kill_all_in_context()
        TnsTest.restore_files()
        # Analise test result
        if Settings.PYTHON_VERSION < 3:
            # noinspection PyUnresolvedReferences
            result = self._resultForDoCleanups
        else:
            # noinspection PyUnresolvedReferences
            result = self._outcome.result

        outcome = 'FAILED'
        if result.errors == [] and result.failures == []:
            outcome = 'PASSED'
        else:
            self.get_screenshots()
            self.archive_apps()
        Log.test_end(test_name=TestContext.TEST_NAME, outcome=outcome)