Reputation: 388
I have recently started using Karate frame work for my API tests cases. It was great. But I was wondering how the feature files are getting parsed ? How to wiring is done in Karate ?
* def handler = function(msg){ return msg.startsWith('hello') }
* def socket = karate.webSocket(demoBaseUrl + '/websocket', handler)
* socket.send('Billie')
* def result = socket.listen(5000)
* match result == 'hello Billie !'
In the above code.. "Karate.websocket" is calling which method in framework ?
Upvotes: 1
Views: 304
Reputation: 58058
Karate uses a JVM-based JavaScript engine that makes calling any Java code on the class-path very easy.
To answer your question, the webSocket()
method is in the ScenarioBridge
class. This class is injected into the feature file with the name karate
at run-time.
Upvotes: 1