Am 21.04.16 um 09:12 schrieb Jens: > Hi > > I think that adding unit tests would greatly improve the ease of implementing > new features for openvpn. I have spend a lot of time coding Java (and > others), and unit testing greatly improved my code quality, my throughput, > and last, but not least, my confidence in the code. Indeed I have become very > humble when it comes to the question of ‘what could possibly go wrong with > this small change?’ > > What would be the steps to include unit testing? > ————————————————————————————————— > > 1) Decide /if/ we want unit tests > 2) Decide /how/ we want unit tests (this includes questions like dependency > management, and the build system) > 3) Decide /which/ framework to use > 4) do it The problem with unit tests and existing software is that, if the software hasn't been written with testing in mind, it is often hard without major refactoring to do the small java style unit tests. Also someone has to write these unit tests and free time is currently sparse among the OpenVPN developers.
A more realistic first step for OpenVPN is a automated testing suite that goes beyond what we have at the moment in shell scripts. Setting up a mininet for example and automatically cofingure client and server, and see if everything works as expected as an example. > How: Dependency management > ————————————————————————————————— > > Adding a test framework would require a way to include & track this > dependency. > > I see three possibilities > > * Copy-and-forget: Add a copy the upstream testing framework and add it as-is > to the source code repo. > * Include-dependency-management: Add some kind of dependency management, e.g. > cmake packages. cmake vs autoconf/automake is somehwat heated discussion. At the moment the project is using autoconf/automake since it has always been using that. > * Use-the-SCM: Use git submodules to add the dependency. > > I dislike Copy-and-forget because it pollutes the repository, and makes > tracking upstream changes very hard. > > I have no experience with Makefile based dependency management > > But I do know how to handle a git submodule. > > I have a very strong preference to using a git submodule for unit testing. > I think how to put a testing framework into git is secondary. If unit tests are useful in the current state, we can discuss about how to include them. Arne