You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Smita Wadhwa <sm...@gmail.com> on 2015/02/27 09:30:17 UTC
Testing Thrift Service
hi,
I want to test my thrift service ( unit test + integrations test) by
having multiple inputs( valid and invalid data inputs) in some file ( in
form of json).
1.) How can I create thrift object from json (read from file) into a
thrift object and send it to thrift service for testing.
My main concern is converting json object into thrift obbject which can be
sent to service for testing
2.) Are there any alternatives other than json for testing service.
--
Thanks & Regards,
Smita
Re: Testing Thrift Service
Posted by Spencer Brown <sp...@bespoke.is>.
I agree with Jens' analysis.
Adding on to what he said, if I were you, I'd just write the test cases in
code. Writing
testobj = TestObj.new
testobj.field1 = 'test data 1'
....
x = client.processTestObject(testobj)
assert(x)
...
is no harder than writing the values for TestObj line by line in a JSON
file, then writing the code to convert the JSON file to the actual TestObj.
And I'd argue the code is more easily understandable to a human reader.
And, writing it in code gives you the opportunity to create a "base
testcase" of an object, then vary it slightly by changing just one field.
In JSON, you'd have to dup the object's JSON representation over and over
again, changing one field each time.
Spencer Brown
On Fri, Feb 27, 2015 at 2:30 AM, Smita Wadhwa <sm...@gmail.com>
wrote:
> hi,
>
> I want to test my thrift service ( unit test + integrations test) by
> having multiple inputs( valid and invalid data inputs) in some file ( in
> form of json).
>
> 1.) How can I create thrift object from json (read from file) into a
> thrift object and send it to thrift service for testing.
>
> My main concern is converting json object into thrift obbject which can be
> sent to service for testing
>
> 2.) Are there any alternatives other than json for testing service.
>
> --
> Thanks & Regards,
> Smita
>