openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #22083
Re: [Merge] lp:~felipe-q/openlp/better-remote into lp:openlp
> I'm not an expert at writing tests, quite the opposite, but if you're stuck,
> I'd be happy to try and help, as I'm sure others will be! Here are my thoughts
> on your tests so far.
>
> For your tests I don't think you should actually be testing that
> impress/PowerPoint actually loads documents. We dont really want to test those
> applications. We want to test that our code does what it is supposed to do
> given a range of simulated inputs. To do that we can patch and mock the calls
> and set the return values. Ideally you want to test the smallest unit
> possible, i.e. the individual methods. Each path of execution needs to be
> tested.
>
> As an example for testing your save_titles_and_notes method:
> There is only one path here.
> You'll need to patch and mock os, open & get_thumbnail_folder
>
> Set up your mocks with return_values or side_effects
>
> Call your method with various different inputs, checking each time that the
> mockes have been called with the expected values.
>
> We only started writing tests since the release of OpenLP 2.0. Alot of the
> existing code needs refactoring to be able to effectively test it!
>
> We're not asking you to test all the presentation code just the methods that
> you added or made significant changes to. (And any changes which are already
> covered by tests)
Phill,
I have added unit tests for presentationcontroller and impresscontroller. Please ignore, for now the other tests that I will be updating soon, and let me know if I am going in the right direction.
Thanks,
--
https://code.launchpad.net/~felipe-q/openlp/better-remote/+merge/191897
Your team OpenLP Core is subscribed to branch lp:openlp.
References