I'm writing small XMPP server using boost::asio and I want to unit-test my code. Questions:
1) I wrote a small socket class that can be used as a replacement for the boost::asio::ip::tcp::socket. If you like, you can have a look at robitzki.de/test_socket.h (test_socket.cpp, test_io_plan.h and test_io_plan.cpp). Depending on the constructor used, the socket can simulate reading/writing of chunks with different sizes. Errors can be simulated too. You are free to use it, if you like.
2) With the socket replacement one can build stress tests for the software under test. This will never guaranty that the code doesn't contain bugs but is better than nothing ;-). Personally I like code reviews best to make sure multithreaded code contains as few bugs as possible.
HTH
Torsten
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With