空手道 UI:数据驱动测试在使用时无法正常工作 driver.quit()

Karate UI : data driven testing not working properly when used driver.quit()

我们正在探索空手道 UI(已经使用空手道进行 API 测试)。出于探索目的,我们使用 https://www.delta.com/ 并且它工作正常。但是在实施数据驱动测试时观察到以下行为

以下是搜索目标的简单特征文件

Feature: Karate UI POC

Background: To set the browser driver

  * configure driver = { type: 'chromedriver', executable: "path to exe"}
  * def data= 
    """
    { 
    fromDes: '#(from)'
    }
    """
  Scenario: Launch the application search for the valid flights

  Given driver 'https://www.delta.com/'
  * driver.maximize()
  * waitUntil("document.readyState == 'complete'")
  * waitForEnabled('#fromAirportName').click()
  * waitForEnabled('#search_input')
  * clear('#search_input')
  * input('#search_input',data.fromDes)
  * driver.quit()

我从 data.feature 文件调用上述功能文件,如下所示

* table destinations
  | from            |
  | 'NEW YORK'      | 
  | 'BOSTON'        | 

* call read('delta.feature') destinations

执行测试时出现以下错误


17:26:55.443 [main] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect, http call failed after 2054 milliseconds for URL: http://localhost:9515/session/6fa82b59df1c1c845974c2f52d481d11/url
17:26:55.445 [main] ERROR com.intuit.karate - http request failed: 
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
17:26:55.445 [main] WARN  c.i.k.d.chromedriver_1592481370453 - session delete failed: 
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
17:26:55.445 [main] DEBUG com.intuit.karate.shell.Command - closing command: chromedriver_1592481370453

1) 但是,如果我删除语句 driver.quit() 测试工作正常。

2) 它是在 Karat UI 中进行数据驱动测试的正确方法吗,因为我们在 Karate API

中使用它很好地退出了

您根本不需要使用 quit(),空手道会自动完成。

你也可以尝试使用版本 0.9.6.RC3

如果您仍然遇到问题,请按照以下流程进行操作,我们将确保问题得到解决:https://github.com/intuit/karate/tree/develop/examples/ui-test