Gaia/Hacking: Difference between revisions

Jump to navigation Jump to search
1,132 bytes removed ,  23 August 2012
Line 153: Line 153:
There is a dedicated test framework for B2G called [https://developer.mozilla.org/en/Marionette Marionette]. You can set up Marionette with [https://developer.mozilla.org/en/Marionette/Setup#Running_Marionette_on_Desktop_Firefox_or_B2G_Desktop_builds B2G Desktop] or for [https://developer.mozilla.org/en/Marionette/Setup#Running_B2G_and_Marionette_on_an_emulator_or_device an emulator or device].
There is a dedicated test framework for B2G called [https://developer.mozilla.org/en/Marionette Marionette]. You can set up Marionette with [https://developer.mozilla.org/en/Marionette/Setup#Running_Marionette_on_Desktop_Firefox_or_B2G_Desktop_builds B2G Desktop] or for [https://developer.mozilla.org/en/Marionette/Setup#Running_B2G_and_Marionette_on_an_emulator_or_device an emulator or device].


=== Desktop ===
=== Unit tests ===
If you are running a desktop build you can also write browser-chrome tests.
See https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Gaia_Unit_Tests
 
==== Running tests ====
Be sure to have MOZ_OBJDIR define in your shell environment.
MOZ_OBJDIR should point to your b2g desktop build directory - the one specified in the .mozconfig file.
 
  cd $GAIA
  DEBUG=1 make
  MOZ_OBJDIR=PATH/TO/THE/BUILD/DIR make mochitest
 
The desktop build of b2g should be lanched with a new window containing the result of the tests run.
 
==== Caveat ====
The test tools will be looking for an executable at path
 
  $MOZ_OBJDIR/dist/B2G.app/Contents/MacOS/b2g-bin
  on a mac, or
  $MOZ_OBJDIR/dist/bin/b2g-bin
  on linux
 
Which isn't generated by the build. So you'll have to symlink your b2g binary to b2g''-bin''.
 
  cd $MOZ_OBJDIR/dist/B2G.app/Contents/MacOS
  # or
  cd $MOZ_OBJDIR/dist/bin
 
  ln -s b2g b2g-bin
 
==== Writing tests ====
For more information about Mochitest, please refer to {{MDN|Mochitest#Test_functions}}
 
For more information about browser-chrome tests, please refer to {{MDN|Browser_chrome_tests}}
 
New browser-chrome tests should be put directly in the $GAIA/tests/ directory.
There is already a few of them there that you can look at to have a better idea about how to write yours!


== Loading Gaia from a server ==
== Loading Gaia from a server ==
Confirmed users
51

edits

Navigation menu