getsmap / smap-responsive

A JavaScript framework for simple creation of web maps with responsive design supporting a range of different browsers and devices
GNU General Public License v3.0
14 stars 12 forks source link

Integrate automated testing #230

Closed johanlahti closed 8 years ago

johanlahti commented 8 years ago

We should start to use automized testing, at least unit testing for our plugins. Ideally, this should be integrated with our gulp script.

johanlahti commented 8 years ago

One conclusion from the research ( including @peterahlstrom's ) is that integration testing makes most sense in our case since our plugins are dependent on so many other things and are mostly visual components (GUI). Some things could possibly be mocked up, and in some cases can be tested isolated independent of the frameworks (e.g. smap, Leaflet) – and should then be implemented as unit tests instead. Especially while developing new plugins a more test-driven-like development should be encouraged.

Next step (if we want to…) will be a continuous integration environment, which @tyskan previously had setup for us using Drone.io + GitHub. Now, the tests could also be part of this flow chain :D .

To setup a new test for you plugin:

  1. Fetch latest code and run npm install to get all the mocha and casperjs stuff installed
  2. Copy test/opacity.js and rename to your plugin's name and add your tests to it
  3. Run node_modules/.bin/mocha-casperjs test/{pluginName}.js OR run gulp test (after modifying the gulpfile.js)