Question

I have several modules that listen on determinate port to communicate with each other using UDP with protocol buffers (C++).
I need to automatize tests for each one of them.
Which is the best strategy to do the testing?

I mean I could write a C++ program that emulates each component using determined commands, for example in xml:

<commands>
  <send cmd="blahblah" from="module1" to="module2">
  <expect cmd="ack" from="module2" to="module1">
</commands>

but I was told that Expect/Tcl/Tk could be used. After some research, I think serialized protobuf's commands can't be done with static text, besides from what I have investigated, Expect works with output stream, and to test those components I need something that works with TCP/UDP sockets. Correct me if I am wrong. So is there some other tool to achieve this behavior (I mean sockets)?

I have no experience either with protobuf nor with expect. I would like to hear some opinions, maybe use some other tools to perform this type of testing.

Was it helpful?

Solution

Expect is not really suitable for binary data, so I wouldn't use it for protocol buffers messages.

I would recommend writing a small C++ (or any other language) program that takes a command to send and and an response to expect, like you suggested. You can use the protocol buffers text format to represent your data, so you do not have to write manual XML -> protobuf conversion for each message.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top