Op 7-5-2013 10:57, Elmar Hinz schreef:
Hello list,
I'd like to come up with a small plan for getting started with unit
testing:
I would like to see some examples of mocking and injection.
I tried to write some tests using the google framework, and started with
the Buffer class. This immediately gives you the problem that it is
dependent on a large number of other classes. So, this would mean that
you have to fake a large part of the LyX codebase.
Then I tried to link against all libraries of LyX, but then I ran into
problems that the application was not initialized (e.g., Package,
translations etc.)
I'm afraid we can't do much testing until the above is solved.
My attempt thus far can be found at:
git://git.lyx.org/developers/vfr/lyx.git
That is not really kosher, but at least a simple way to get started
directly.
It is done by use of a simple preprocessor directive:
#public_on_testing
Once a wall of tests is created to ensure the behaviour of the given API,
more skilled approaches can be introduced.
Ideally, one would not need to care about private variables because we
are only interested in that the public interface does what it is
supposed to do. Right ?
Vincent