Re: Mock Testing of Grilo Plugins



On Thu, 2012-08-02 at 17:51 +0200, Jens Georg wrote:
> On Do, 2012-07-26 at 16:01 +0200, Víctor M. Jáquez L. wrote:
> 
> > As Jens already said, get_url_now() has two implementation which is chosen in
> > compile time, given the available libsoup version.
> > 
> > Hence, it would be possible to add a third implementation, chosen at compile
> > time by the unit tests.
> 
> While this approach works great simulation-wise, this seems to be
> slightly more difficult as the things to be tested live outside of
> grilo's source tree, such as grilo-plugins.

Personally, I would implement this so:
- Don't make the plugin developers have to write any different code, it
should be completely transparent to them
- Make it a run-time switch, an envvar seems like something innocuous
enough to use
- Add a capture mode (running in this mode, the GrlNetWc would keep a
disk copy of everything it downloads), GRL_WEB_CAPTURE_DIR=...
- Make it easy to construct fake data (this is the data I want for this
URL).

Drilling down a bit more into Mathias' ideas, I would either make the
existing network code into a subclass (and move the current
implementation into its own subclass as well), or simply put the code
into helpers with if's around in the main code.

Cheers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]