|
|
| (12 intermediate revisions by 3 users not shown) |
| Line 1: |
Line 1: |
| ==Getting the Tests==
| | #redirect [[Mobile/Fennec/Android#Testing]] |
| Edit your mozconfig to contain the following lines:
| |
| | |
| <pre>
| |
| ac_add_options --enable-tests
| |
| ac_add_options --enable-mochitest
| |
| </pre>
| |
| | |
| Get the source and build according to [[Mobile/Build/Fennec|instructions]].
| |
| | |
| ==Porting tests to N800==
| |
| If following [[Mobile/Build/Fennec#Running Fennec on Maemo|directions]] for running fennec on N800/N810 devices, also transfer the _tests directory to the device. From your objdir:
| |
| | |
| <pre>
| |
| cd xulrunner
| |
| tar chf tests.tar _tests
| |
| </pre>
| |
| | |
| Transfer tar file to device via scp so that tests.tar is in the same directory as the xulrunner and fennec packages. In order for the tests to run properly on the mobile, some of the directory structure of the original tree must be preserved so after untarring all the mobile packages, run this on the device:
| |
| | |
| <pre>
| |
| mv xulrunner bin
| |
| mkdir xulrunner; mkdir xulrunner/dist
| |
| mv bin xulrunner/dist/bin
| |
| mv _tests xulrunner/_tests
| |
| </pre>
| |
| | |
| ==Running the tests==
| |
| Run the tests from the objdir with:
| |
| <pre>
| |
| cd xulrunner/_tests/testing/mochitest
| |
| python runtests.py --appname=<fennec executable>
| |
| </pre>
| |
| | |
| where fennec executable is the absolute path to the fennec executable, /root/fennec/fennec, e.g. Additional arguments like individual test files can be specified, general Mochitest instructions can be found here [http://developer.mozilla.org/en/docs/Mochitest].
| |
| | |
| note: The tests are flakey on mobile devices, so use the --test-path, --autorun, and --log-file options.
| |
| | |
| ==Adding tests==
| |
| Add a directory named "tests" to the component. In the Makefile.in for the tests directory add a _TEST_FILES section with a list of the files in this directory needed to run the mochitest (the mochitest html file itself and any helper files). Then add this line to the bottom of the Makefile.in:
| |
| <pre>
| |
| libs:: $(_TEST_FILES)
| |
| $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
| |
| </pre>
| |
| | |
| When you build, the tests will be added to the xulrunner application's mochitest set.
| |