FacebookTwitterFlickrYoutuberss

Writing Testeable Templates

From Zentyal Linux Small Business Server
Revision as of 15:15, 12 November 2013 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In general the guidelines used for writing highly modular and decoupled software also applies here.

We will look to some advice specific to Zentyal. You will notice that almost all of the issues are variations on the theme of isolation and decoupling from environment. Zentyal uses a lot of external programs so it is easy to lose sight of the isolation and decoupling issues. This is how they creep back in to Zentyal and the unit tests.

  • Never hard-code file or program paths.
 Instead store them in Zentyal configuration and retrieve them. That eases mocking and test environments creation.
  • Never hard-code root commands.
 Always construct them using the previous technique and isolate the construction in a object method to avoid code duplication
  • When possible, provide specific configuration files for daemons.
  In this way we will avoid overwriting it while testing and we will be safe from permission issues.


Template:TracNotice

Personal tools
Namespaces

Variants
Actions

Zentyal Wiki

Zentyal Doc
Navigation
Toolbox