Does anyone have any comments on how to write unit tests for 3rd party applications like kamailio...that allow you to write "configuration scripts"? https://www.kamailio.org/wiki/cookbooks/4.0.x/core/cfg#the_configuration_file I'm looking for more an approach vs. specifics.

In this particular case, these configuration files are written in a proprietary script format that kamailio understands. Kamailio itself provides a compile option will test syntax of these files... but not much more.

We also have lua code that these cfg files call. I think its going to be a little easier to write unit tests for these methods in the lua files... except that some of the functions are expecting data from the cfg. My idea is to capture / dump this data ... and for the unit tests, seed the tests with data that looks like what kamailio would send via these cfgs and then test from there.

  • 1
    I think that How to test when arranging the data is too cumbersome? may be related to your question, but what is it that you want your tests to verify? Your Lua code, or the config scripts? – Josh Caswell Aug 10 '16 at 18:11
  • both. so much of the SIP solution we've generated is in configuration scripts that we've written... that also call external lua files – dot Aug 10 '16 at 18:24
  • 3
    Well, I guess what you are asking for is probably too broad for the Q&A format of this site. There is probably no "easy" way to solve this, you need to try out different approaches, get the details right, need a lot of diligence and reasearch effort, and see how it comes out. And there is probably no general solution for "applications like kamailio" - there might be a specific solution for kamailio, so this is a tool specific question, which makes it off-topic for "Programmers". – Doc Brown Aug 11 '16 at 7:54
  • How do you unit test 3rd party applications? The short answer is - you don't. You can set up some automated integration tests, but that's about it. – Eternal21 Aug 12 '16 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.