Like nymia, I too struggled with getting my brain around the Mozilla code. There are some tests -- make sure you do not have ac_add_options --disable-tests in your .mozconfig when you build, and you'll see them built in the dist/bin directory. Also, many components have a test directory, and the tests are in XUL, rather than C/C++. Using the xpshell program in the dist/bin directory you can execute arbitrary javascript, and the very simple viewer executable can also run test XUL.