190 | | We separate data out into a separate file, so that this is easy to change to allow reruns of the tsts with different data sets. |
191 | | |
192 | | == Unit Tests == |
193 | | There are additional unit tests available, which also require running with the IFRC_Train preopulate, 'settings.base.prepopulate = 27': |
194 | | |
195 | | To run all unit tests: |
196 | | {{{ |
197 | | python web2py.py -S eden -M -R applications/eden/modules/unit_tests/suite.py |
198 | | }}} |
199 | | |
200 | | These unit tests are meant to detect problems early during development, which means you should run them quite often while you're still working on the code (read: before and after every little change you make) rather than expecting them to be run during QA cycles. That again means you would more often need to run tests for particular modules than the whole suite. |
201 | | |
202 | | For every module in {{{modules/s3}}} and {{{modules/eden}}}, you can find the corresponding unit test module under {{{modules/unit_tests/eden}}} resp. {{{modules/unit_tests/s3}}} (if one exists). |
203 | | |
204 | | To run tests for particular modules: |
205 | | {{{ |
206 | | # e.g. for modules in modules/s3 |
207 | | python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3resource.py |
208 | | # e.g. for modules in modules/eden |
209 | | python web2py.py -S eden -M -R applications/eden/modules/unit_tests/eden/pr.py |
210 | | }}} |
211 | | |
212 | | It can be a very powerful development strategy - especially for back-end APIs - to first implement unit test cases for the functionality you intend to implement before actually implementing it. Apart from preventing bugs, this helps you to validate your design against requirements, and to keep the implementation simple and focussed. Additionally, the test cases can be a rich source of code samples how to apply your API methods. |
213 | | |
214 | | == Role Tests == |
215 | | This test is used to check the permissions of user roles. Currently is limited to the IFRC (Red Cross) roles for RMS, but could be extended: |
216 | | {{{ |
217 | | python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --suite roles |
218 | | }}} |
219 | | |
220 | | == Load Testing == |
221 | | We recommend using [Testing/Load Tsung] |
222 | | |