-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To add support for GRPC protocol #412
Comments
I'll leave this open for a while - but in my opinion you can do this today. You need to write 2 utilities. One to convert payloads to JSON and vice-versa and another to listen for async messages, maybe using polling. you can use the netty example as a reference: https://github.com/intuit/karate/tree/master/karate-netty#consumer-provider-example and then you will be up and running. I suggest you do that and report back and then if it makes sense we can roll the above utilities into Karate or make them a separate maven module since you are the first who has asked for this, I don't consider this a priority just yet. |
I might also be in a position to test this and share findings. Since majority of our APIs are using karate, I was quite Interested in covering few other systems to move towards internals verifications with
|
@ptrthomas I have gone through your comments on #398 , I am interested in having karate DSL extended to more underlying systems to verify other than APIs :) May be we will find a way. As of now DB/APIs are straight forward and as per your example here I can now try gRPC as well. |
A lot of our projects are going towards using gRPC and requests for gRPC is being requested more and more. |
it doesn't need to be re-opened. just submit a PR referencing this ticket. does that make sense ? |
Okay! |
@avyasbms I made some comments above already hope that gets you started |
@ptrthomas would appreciate an example for grpc if possible since our project is also going to use grpc now |
@sauravkumar05 no I haven't used GRPC yet. and please read my first comment in this thread carefully. |
Hi @ptrthomas I want to implement the topic, and my opinion like this: Feature:
Background:
* url 'ip+port' # grpc ip and port
Scenario:
* def in = read('pb.json')
* rpc 'rpc-service-name' # like path
* request method grpc # like post/put
* match response match {} so, How should I extend karate or write middleware? (I should refer to what code?) thanks! now I can solve the follow topic:
|
@thinkerou here is what I suggest you should do. there is no need to add a new keyword to karate. we want to keep it simple ! instead use Java and the code will look similar to what you have. which I think is fine. you can read my detailed comments here: I was just seeing if it possible for me to add this demo to Karate but it is too complicated and needs some binary etc to be downloaded, sorry I don't have time. there are very few "hello world" samples. if you can create an example, I will be happy to add it to karate.
That's all ! Then you will use all of Karate EXCEPT the HTTP part. Which is fine. 90% of what you need Karate for is test data and assertions. Feature:
Background:
* def Rpc = Java.type('com.mycompany.Rpc')
* def config = { host: 'myhost', port: 9000, extra: 'blah' }
# constructor takes a java Map
* def rpc = new Rpc(config)
Scenario:
* def payload = read('pb.json')
* def response = rpc.invoke('rpc-service-name', payload)
* match response == { expected: 'foo' } |
@ptrthomas thanks, I will write some code and if they run ok after I will post one helloworld example and commit one pull request. |
@thinkerou sure. one more thing. not many people know that karate can convert JSON to a Java Bean and vice versa. so in case it it useful, please see this example: https://github.com/intuit/karate/blob/master/karate-junit4/src/test/java/com/intuit/karate/junit4/demos/type-conv.feature#L122 |
@ptrthomas thanks a lot, I have one helloworld example please see https://github.com/thinkerou/karate-grpc/tree/master/karate-grpc-demo/src/test/java/demo/helloworld |
@thinkerou excellent ! this is exactly what I had in mind. and I will refer other users to your example. I will also add a link in the documentation. please continue on the same lines. one suggestion for improvement is if you try print to the log, it should appear in the HTML report. maybe this is not needed, but something to think about. |
This is also I was in need of as well, thanks.
|
@ptrthomas ok, thanks! |
@thinkerou do you have a Twitter ID ? |
sorry for the spam - if anyone on this thread is interested, this Quora question needs an answer ;) |
@ptrthomas Twitter ID also is |
@thinkerou you are so gonna love this ! https://twitter.com/KarateDSL/status/1042055022052179968 I got the idea after seeing your example. |
@ptrthomas this will very useful which will perfect to combine auto test with perf test. thanks! |
It will help us to automate the messaging services which are written on https://grpc.io/blog/pubsub
The text was updated successfully, but these errors were encountered: