Difference between revisions of "Mochitest FAQ"

From CDOT Wiki
Jump to: navigation, search
(Getting Started)
(Making a pull request to someone that you didn't fork from)
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
# Make sure you have forked a copy of mozilla-central. If you haven't, you can fork from [https://github.com/humphd/mozilla-central here]
 
# Make sure you have forked a copy of mozilla-central. If you haven't, you can fork from [https://github.com/humphd/mozilla-central here]
 
# Add a remote for rhung's mozilla-central (this is where you'll be making your pull requests for the tests) <pre>git remote add [an alias] git://github.com/rhung/mozilla-central.git</pre>
 
# Add a remote for rhung's mozilla-central (this is where you'll be making your pull requests for the tests) <pre>git remote add [an alias] git://github.com/rhung/mozilla-central.git</pre>
# For a basic template to get started on writing mochitests, you can get one [http://pastebin.com/2ikiY7v8 here].
+
# For a basic template to get started on writing mochitests, you can get one [http://pastebin.com/vxmsepVh here].
  
 
== Making a pull request to someone that you didn't fork from ==
 
== Making a pull request to someone that you didn't fork from ==
 +
'''Before you make a pull request, please pull from rhung's mouselock-tests repo so that you don't get asked to fix possible merge conflicts'''
 
# Click on the pull request button and you should get a screen with something similar to [http://raymondhung.files.wordpress.com/2011/11/changepulltarget.png this]
 
# Click on the pull request button and you should get a screen with something similar to [http://raymondhung.files.wordpress.com/2011/11/changepulltarget.png this]
 
# By clicking on the '''Change Commits''' you'll get a screen to look something like [http://raymondhung.files.wordpress.com/2011/11/changingtarget.png this]
 
# By clicking on the '''Change Commits''' you'll get a screen to look something like [http://raymondhung.files.wordpress.com/2011/11/changingtarget.png this]
Line 12: Line 13:
 
# Finally you'll just have to fill in [http://raymondhung.files.wordpress.com/2011/11/fillandfinish.png this], once you do, click '''Send Pull Request''' and if everything works, you're done!
 
# Finally you'll just have to fill in [http://raymondhung.files.wordpress.com/2011/11/fillandfinish.png this], once you do, click '''Send Pull Request''' and if everything works, you're done!
  
== Feel free to contribute more information! ==
+
== FAQ==
 +
'''Question:''' Where do I store my tests?
 +
 
 +
'''Answer:''' Put them in the dom/tests/mochitest/mouselock/ folder. Also in the same directory you need to edit Makefile.in file, under _TEST_FILES =\ before $(NULL) you need to add in the file name of your test file.
 +
'''IMPORTANT''' when you add the test file in Makefile.in you must use the tab key and not space, using space will break the build.
 +
 
 +
'''Question:''' How do I get mochitest to run?
 +
 
 +
'''Answer:''' To run the particular mochitest you want, you go to your root mozilla folder (in most cases this will be mozilla-central) and type:
 +
<pre>TEST_PATH=dom/tests/mochitest/mouselock/[your filename].html make -C [the directory you built Firefox to] mochitest-plain</pre>
 +
 
 +
'''Question:''' I'm getting a 404 page not found when trying to get my mochitest to run. I have the file in dom/tests/mochitest/mouselock, and I've added the file to the make file in the same directory.
 +
 
 +
'''Answer:''' Recompile Firefox so that the change in your make file takes effect.

Latest revision as of 16:24, 2 December 2011

Getting Started

  1. Make sure you have forked a copy of mozilla-central. If you haven't, you can fork from here
  2. Add a remote for rhung's mozilla-central (this is where you'll be making your pull requests for the tests)
    git remote add [an alias] git://github.com/rhung/mozilla-central.git
  3. For a basic template to get started on writing mochitests, you can get one here.

Making a pull request to someone that you didn't fork from

Before you make a pull request, please pull from rhung's mouselock-tests repo so that you don't get asked to fix possible merge conflicts

  1. Click on the pull request button and you should get a screen with something similar to this
  2. By clicking on the Change Commits you'll get a screen to look something like this
  3. If you forked from humphd's repository, your Base branch should look something similar to the screenshot posted above. You want to change from humphd/mozilla-central to rhung/mozilla-central
  4. Next after the @ symbol, you want to make sure to select the mouselock-tests. It'll look something like this
  5. You can also make sure you have proper branch selected by changing the branch shown under your Head branch box after everything that needs to be changed is changed, click Update Commit Range
  6. Finally you'll just have to fill in this, once you do, click Send Pull Request and if everything works, you're done!

FAQ

Question: Where do I store my tests?

Answer: Put them in the dom/tests/mochitest/mouselock/ folder. Also in the same directory you need to edit Makefile.in file, under _TEST_FILES =\ before $(NULL) you need to add in the file name of your test file. IMPORTANT when you add the test file in Makefile.in you must use the tab key and not space, using space will break the build.

Question: How do I get mochitest to run?

Answer: To run the particular mochitest you want, you go to your root mozilla folder (in most cases this will be mozilla-central) and type:

TEST_PATH=dom/tests/mochitest/mouselock/[your filename].html make -C [the directory you built Firefox to] mochitest-plain

Question: I'm getting a 404 page not found when trying to get my mochitest to run. I have the file in dom/tests/mochitest/mouselock, and I've added the file to the make file in the same directory.

Answer: Recompile Firefox so that the change in your make file takes effect.