1

Given the same feature file to test an invalid url endpoint, I am seeing that 1.2 works without issue, but when switching to v 1.3, the endpoint file is not found. No other change made then updating the version in the pom file.

Feature: Common failures across all endpoints
    Background: PreRequisites 
        * def dataSourceRow = karate.get('karate.dsRow', 1)
        * def dataSourceEnv = karate.get('karate.env', 'dev')
        * callonce read('../../../../service-config.js') { dsRow: '#(dataSourceRow)' , env: '#(dataSourceEnv)' }
        
        * if (skipDomainFlag) {karate.logger.debug('skipDomainFlag is set to true so Domain calls cannot be ran!'); karate.abort(); }
        * callonce read('classpath:adapters/domainsession.feature')
    
        * configure afterFeature = function(){ karate.call('classpath:adapters/logout.feature'); }
    
        * url baseUrlDomain + domainPath
        * configure headers = domainHeaders
        * header host = domainHost
        
        * def endpointFile = '_v3endpoints.json'

    ##**********
    ## Common Domain failures shared for all endpoints
    ##**********  
    Scenario Outline: Scenario for <name> endpoint - Invalid endpoint
        * def endpoint = '<endpoint>'
        * replace endpoint
        | token           | value              |
        | endpointEnd     | 'x'                |
        | pathVariable    | validPathVariable  |
        | pathVariable2   | validPathVariable2 |

        Given path endpoint
            And request <payload>
        When method <endpointMethod>
        Then status 404

    Examples:
    | read(endpointFile) |

Result using 1.2

Karate version: 1.2.0
======================================================
elapsed:  12.04 | threads:    1 | thread time: 8.07 
features:     1 | skipped:    0 | efficiency: 0.67
scenarios:    1 | passed:     1 | failed: 0
======================================================

Results using 1.3

Karate version: 1.3.0
======================================================
elapsed:   2.36 | threads:    1 | thread time: 0.00 
features:     1 | skipped:    0 | efficiency: 0.00
scenarios:    1 | passed:     0 | failed: 1
======================================================
>>> failed features:
js failed:
>>>>
01: read(endpointFile)
<<<<
org.graalvm.polyglot.PolyglotException: ReferenceError: "endpointFile" is not defined
- <js>.:program(Unnamed:1)

Sample excerpt of endpointfile while returns a json object for use in outline

[
    {
        "name": "v3/lob/{lineOfBusiness}",
        "endpoint": "v3/lob<endpointEnd>/<pathVariable>",
        "invalidPathVariable": "test",
        "invalidPathVariable2": "",
        "validPathVariable": "Internet",
        "validPathVariable2": "Internet",
        "endpointMethod": "GET",
        "payload": "{}"
    }
]
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
mike
  • 383
  • 1
  • 12

0 Answers0