Mobile/Fennec/Android/Testing: Difference between revisions

Jump to navigation Jump to search
Line 199: Line 199:


== cppunittests ==
== cppunittests ==
 
[https://developer.mozilla.org/en/docs/Compiled-code_automated_tests]
To run a single compiled code test:
To run a single compiled code test:


   cd <objdir-droid>
   mach cppunittest <test>
  export TEST_PATH=<test>
  make cppunittests-remote
 
For example, TEST_PATH=xpcom/tests/TestTimers, or TEST_PATH="xpcom/tests/TestTimers xpcom/tests/TestFile".
 
To run all the compiled code tests in a directory:
 
  cd <objdir-droid>
  make -C <dir> cppunittests-remote
 
For example:
 
  make -C xpcom/tests cppunittests-remote
 
Advanced features:
 
As with xpcshell tests, you can skip setup if needed:


  export EXTRA_TEST_ARGS="--noSetup"
For example,


This will avoid copying any files to the device -- be sure that all necessary files are on the device before using this!
  mach cppunittest <absolute-path-to-objdir>/xpcom/tests/TestTimers


You can change the environment variables seen by the unit test:
To run all the compiled code tests listed in the master cppunittests.ini manifest:


   export EXTRA_TEST_ARGS="--addEnv MYVAR=value"
   mach cppunittest
  export EXTRA_TEST_ARGS="--addEnv MYVAR1=value1 --addEnv MYVAR2=value2"
  export EXTRA_TEST_ARGS="--addEnv HOME="


Notes:
Notes:
* Either adb or sut device manager may be used
* Specifying the test by relative path is difficult; specify an absolute path to the test binary.
* It is not possible to run all tests in a directory.
* All files are copied to /data/local/tests by default. On some devices, you may need to create /data/local/tests and make it world writable.
* All files are copied to /data/local/tests by default. On some devices, you may need to create /data/local/tests and make it world writable.


Confirmed users
1,759

edits

Navigation menu