Buffer in JS file isn't recognized (API tests automation with Karate Framework)

后端 未结 2 478
野趣味
野趣味 2021-01-25 18:46

We\'re automating our test with karate framework. In one of our features we need to decode a token and get a scope in the response. Everything works well, except this code in js

2条回答
  •  无人共我
    2021-01-25 19:10

    I'm pretty sure that Buffer is advanced / non-standard or NodeJS so it probably is not supported by the JVM JS engine (Nashorn).

    Here's my recommendation. For this case, do the work using Java utilities.

    For example, look at the Karate basic-auth example in the doc which uses Base64 encoding.

    If it is really complex, simply create a Java static function, it will be much easier to test as a side-benefit. Hope this helps !

提交回复
热议问题