空手道:有没有办法针对示例应用函数:变量?

Karate: is there a way to apply functions against Examples: variables?

我通过了空手道考试:

Feature:  Armstrong numbers

  Background:
    * url baseUrl
    * configure lowerCaseResponseHeaders = true

  Scenario Outline: Find Armstrong numbers in the range from <start> to <end> are <result>
    Given path '/armstrongs'
    And param start = <start>
    And param end = <end>
    When method get
    Then status 200
    And match header content-type contains 'application/json'
    And match header content-type contains 'charset=utf-8'
    And match response == {numbers:<result>, start:<start>, end:<end>, count: <count>, type:Armstrong}
    Examples:
      | start | end    | result                | count
      | 1     | 10     | [1,2,3,4,5,6,7,8,9]   | 9
      | 100   | 1000   | [153, 370, 371, 407]  | 4
      | 90000 | 100000 | [92727, 93084]        | 2

但是,我想要做的是没有示例中的计数变量:部分,只是通过这种方式从变量的长度中导出计数:

Feature:  Armstrong numbers

  Background:
    * url baseUrl
    * configure lowerCaseResponseHeaders = true

  Scenario Outline: Find Armstrong numbers in the range from <start> to <end> are <result>
    Given path '/armstrongs'
    And param start = <start>
    And param end = <end>
    When method get
    Then status 200
    And match header content-type contains 'application/json'
    And match header content-type contains 'charset=utf-8'
    And match response == {numbers:<result>, start:<start>, end:<end>, count: <result>.length, type:Armstrong}
    Examples:
      | start | end    | result
      | 1     | 10     | [1,2,3,4,5,6,7,8,9]
      | 100   | 1000   | [153, 370, 371, 407]
      | 90000 | 100000 | [92727, 93084]

当我尝试此操作时,出现错误:

Armstrong.feature:15 - net.minidev.json.parser.ParseException: Unexpected token . at position 72.

测试失败。

有没有办法针对示例应用函数:变量,例如 .length,以获得预期的结果并通过测试?

进行此更改:

And def result = <result>
And match response == {numbers: '#(result)', start: <start>, end: <end>, count: '#(result.length)', type: 'Armstrong' }