Reputation: 103
Most of the Cordova plugins have a folder called 'tests', which hosts plugin.xml and tests.js. Can anyone shed some light on how to run them, and what is required to run? There seems no relevant documentation. Thanks!
Upvotes: 8
Views: 6814
Reputation: 1512
There is also a plugin called cordova-paramedic, based on cordova-test-framework which automates manual steps like modifying config.xml
:
cd cordova-plugin-name && npm install cordova-paramedic && node node_modules/cordova-paramedic/main.js --platform android --plugin ./ --verbose
Upvotes: 1
Reputation: 6095
There's an official Cordova library for running the unit tests.
From the Cordova Plugin Test Framework on github:
The
org.apache.cordova.test-framework
plugin does two things:
- Defines the interface for cordova plugins to write tests
- Provides a test harness for actually running those tests
Tests run directly inside existing cordova projects, so you can rapidly switch between testing and development. You can also be sure that your test suite is testing the exact versions of plugins and platforms that your app is using.
Visit that page; there's plenty of information there on running existing tests and using the framework for your own plugins.
Upvotes: 4