- UI component testing
- Script ordering
Assuming you have node >=0.6.0 and npm installed:
npm install cup -g
Command Line App
The create Command
This command produces a folder containing:
- vendor: for vendor js libraries such as jquery and jasmine which are automatically downloaded. Note, the latest version of jquery is downloaded by default, for jasmine, cup currently downloads v1.1
- spec: where you will place you carefully prepared jasmine specs ;)
- spec/visual: some special case specs (more on this in the Browser App section below)
- src: ...
- lib: scripts in this folder are included in uglification and are always loaded before src. This directory is useful for third party libraries or support code which will be included in the build output.
- cupfile: a file which is used to describe the cup project (more in the
- licence.txt: A default open source licence
Sample cupfile with comments:
- root: an overview of the project including links to build output and a file list for the project
- empty: the same as debug, but a completely empty page (no cup app header or css). This is for debugging UI components withoutany interference from the stylesheets or controls in the cup application itself.
- src: run specs on the lib and src files
- concatenated: run specs on the concatenated version of build output
- uglified: run specs on the uglified version of the build output
- visual: exercise visual specs (see below)
The browser application includes middleware that acts as a directory server for all paths that are not routes in the main application. For example:
http://<host>[:<port>]/lib will serve a directory listing for the lib folder.
Visual specs help to facilitate the visual verification of behaviour which is infeasible to write automated tests for. For examples:
- An animation doesn't flicker
- A the colours scheme makes for easy reading
- A slider control is responsive when rapidly changing its position
To create a visual spec, add a jade template in the
spec/visual directory. Any directory structure within
spec/visual may be used to organise visual specs as you see fit. An index of available visual specs is available in the browser app.
Each slim template under
Note: No style sheets are automatically loaded for visual specs.
spec/visual directory unless explicitly referenced in the
cupfile with the following constraint...
- spec (only on pages which run specs)
Build output is referenced instead of lib and src on the relevant pages (such as when running spec on uglified build output). Only lib and src are considered build input.