1

現在、私は Python の Galen フレームワークを使用しています。仮想マシンとgalenpy内でPython 2.7、Ubuntu 18.04を使用しています。単体テストを実行すると、以下のようなエラーが発生します

MainThread - line:117 in remote_connection - Could not connect to port 4444 on host localhost
MainThread - line:136 in remote_connection - Could not get IP address for host: localhost

このフレームワークの要件は、selenium、nose2、galenpy、wheel、thrift、pyhamcrest、requests で、すべてインストールしましたが、どこを間違えたのかわかりません。

import os
import unittest
from galenpy.galen_api import Galen
from galenpy.galen_report import TestReport, info_node, warn_node, error_node
from galenpy.galen_webdriver import GalenRemoteWebDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


class GalenTestBase(unittest.TestCase):

    def __init__(self, methodName='runTest'):
        super(GalenTestBase, self).__init__(methodName)

    def setUp(self):
        self.driver = GalenRemoteWebDriver("http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.FIREFOX)

    def tearDown(self):
        if self.driver:
            self.driver.quit()

    def check_layout(self, test_name, specs, included_tags, excluded_tags):
        try:
            parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__) + '/..'))
            test_report = TestReport(test_name)
            check_layout_report = Galen().check_layout(self.driver, os.path.join(parent_dir, "test", "specs", specs),
                                                       included_tags, excluded_tags)

            test_report.add_report_node(info_node("Running layout check for: " + test_name)
                                        .with_node(warn_node('this is just an example'))
                                        .with_node(error_node('to demonstrate reporting'))) \
                .add_layout_report_node("check " + specs, check_layout_report).finalize()
            if check_layout_report.errors > 0:
                raise AssertionError(
                    "Incorrect layout: " + test_name + " - Number of errors " + str(check_layout_report.errors))

        except Exception as e:
            raise e

出力は以下のようなものです

Testing started at 10:34 ...
stdout listener - line:43 in remote_service_logging - starting listener for STDOUT

stderr listener - line:43 in remote_service_logging - starting listener for STDERR

Remote service - line:62 in remote_service_logging - starting Galen API Remote Service logger
MainThread - line:58 in remote_service_lifecycle - Started server at port 9092
Remote service - line:74 in remote_service_logging - [main] INFO galen.api.server.GalenApiServer - Starting server on port 9092
MainThread - line:117 in remote_connection - Could not connect to port 4444 on host localhost
MainThread - line:136 in remote_connection - Could not get IP address for host: localhost
Remote service - line:74 in remote_service_logging - [pool-1-thread-2] INFO galen.api.server.GalenApiServer - Setting up new WebDriver session
Remote service - line:74 in remote_service_logging - [pool-1-thread-2] ERROR galen.api.server.GalenApiServer - Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.
MainThread - line:47 in galen_webdriver - Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.
Remote service - line:74 in remote_service_logging - [pool-1-thread-4] INFO galen.api.server.GalenApiServer - Shutting down Galen API service.
Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 320, in run
    self.setUp()
  File "/home/yuceturk/Desktop/galen-sample-py-tests-master/src/galen_test_base.py", line 31, in setUp
    self.driver = GalenRemoteWebDriver("http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.FIREFOX)
  File "/home/yuceturk/Desktop/galen-sample-py-tests-master/venv/local/lib/python2.7/site-packages/galenpy/galen_webdriver.py", line 49, in __init__
    raise e
SessionNotCreatedException: Message: Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.
4

1 に答える 1