The unit tests architecture

Nathan Sala sala.nathan at gmail.com
Thu Jan 28 02:00:53 CET 2010


Hello,

We are students from Toulouse, France and we are working on Amarok as
a university project. One of our tasks has been to create new context
applets
using the last.fm services. The applets we created are Upcoming Events and
Similar artists.

We have met an issue while trying to create unit tests for the Data Engines
of
our applets.I will try to explain it clearly, I hope you can understand =)

Actually, the current Amarok unit tests system is not based on the KDE
standard
unit tests system. Indeed, instead of building a specific executable for the
tests, those
ones are integrated in the main amarok command by passing the --test option.
This way,
we avoid the need of initializing all the Amarok "context" in order to test
the methods:
Amarok is launched and then the tests are performed.

Anyway, while working on Data Engines, we are stuck because we simply can't
link to
our engines in our test files. It is the consequence of the fact that the
Data Engines are not
linkable from our test directory. The tests are part of amaroklib_LIB_SRCS
and the engines
link to amaroklib_LIB_SRCS but are not part of it. The result is we can't
instanciate any of
our data engines in the test folder. Adding the DataEngines classes into
amaroklib_LIB_SRCS
will result in linking error due to recursive inclusion  (if I understand
correctly).


We have thought about two solutions:

   - Perform "black box tests" instead of "white box" ==> use the DataEngine
   methods
   instead of MyAppletDataEngine methods. But the problem is the way to
   request a
   DataEngine from the KDE plugin service seems complex regarding to the
   Applet::dataEngine(QString)
   method. If you someone knows a more simple way to request the DataEngine,
   please let us know.
   - Set up standard unit tests in the Qt/KDE way for our engines. It could
   be a first step
   for a massive migration. The difficulty resides in initializing enough
   context to have our
   methods work into the tests.

If we can collect ideas and/or opinions about this problem, it would be a
great help =)
Thanks for your support.

Best regards,
The IUP ISI Amarok team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/amarok-devel/attachments/20100128/cc62d757/attachment.htm 


More information about the Amarok-devel mailing list