How to avoid breaking the tree!

My journey as an Outreachy intern for Mozilla began about three months ago, and it seems like the shortest Summer of my life. This is primarily because the internship was fruitful on all levels. I got to learn so much, and the fact that my project is soon going to be live, makes me feel like I’m living the dream! I would strongly recommend everyone, who wishes to get momentous growth and new experiences, to apply for the Outreachy Program, and especially, for Mozilla!

With most of the project design and copy done, we are just left with writing some tests for what we have changed or added. I am getting to learn a lot about the test-writing process at Mozilla, because there are various ways through which one can test the tests.


Mochitests (just one of the automated regression testing frameworks used by Mozilla) have become my off-late best friend in test writing. Mochitest is an automated testing framework that is built on top of the MochiKit JavaScript libraries.These tests report success or failure to the test harness using JavaScript function calls.

Mochitest runs as part of the build and test process in Mozilla, so if something breaks, we get to know pretty quickly of the commit responsible for it. However, I still run Mochitest myself before I commit so as not to be the one who breaks the tree and hinders everything.

Build Mozilla with the changes

Run ‘./mach mochitest’


Run ‘./mach mochitest <path_to_specific_file>

Try Server:

The other type of rather generic method is to test a patch without actually checking the patch into the core repository by using Try Server. In order to be able to use Try Server, level 1 commit access is needed.

Firstly, some configuration will be needed by running: ./mach mercurial-setup. Then, there are several ways to schedule using Tree Herder. One could push to try by: ./mach try empty and then manually decide the jobs, or schedule jobs using try syntax by using mach. I personally go with this command:

./mach try -b od -p macosx64,win32,win64,linux64 -u mochitests -t none

Try chooser extensions and using mq are other techniques.

There are other methods to enable tests in Mozilla, but these two are the ones that I find the most handy! Hopefully as time goes by, I’ll be able to come across newer testing methods in order to make sure to not break the tree, and of course, make the web safer for everyone!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s