Automated Tests and KConfig

Albert Astals Cid aacid at kde.org
Tue Aug 18 00:42:29 BST 2020


El dilluns, 17 d’agost de 2020, a les 23:57:20 CEST, Matthieu Gallien va escriure:
> Hello,
> 
> I have been wandering if there is a general solution to use KConfig inside 
> automated tests.
> 
> I have been having difficulties (and another contributor to Elisa) to integrate 
> the singleton object lifetime with the need to run different tests isolated and 
> using the singleton (including code to initialize it).

Call 
  Elisa::ElisaConfiguration::instance(("testfoo"));
in the initTestCase() function of each testfoo app?

Potentially include QStandardPaths::setTestModeEnabled(true) too?

Or when you say "test" you mean each of the subtests inside a test app?

If you need to reset the values between them i guess you can just call setDefaults() in the init() function of each test app?

Cheers,
  Albert

> 
> One problem I am trying to solve is calling <Class name>::initialize multiple 
> times.
> 
> One solution I have been using is encapsulating all KConfig code inside a class 
> and fake it in the tests. Is there other solution ?
> 
> Thanks
> 
> Best regards
> 
> 
> 








More information about the kde-core-devel mailing list