I've written about PyCharm before.
I is my IDE of preference for Python, and I must admit it does an admirable job for html and Javascript as well.
I really like its interactive debugging features, which I use all the time when writing and, more often, fixing,
Web QA tests. As I have now started working on Gaia
(the UI for Firefox OS) tests as well I wanted to try to use
Pycharm to interactively debug them as well. I asked my colleague Dave Hunt
to help me figure out how to do so during our work week in San Francisco and together we were able to come up with the
following solution:

Python interpreter:The interpreter to use for this project. This will likely point to a
virtualenv.

Working directory:path/to/gaia-ui-tests

Make sure the Show settings checkbox is checked. This will allow you to change the name of the test whenever you run one.

Click Apply, then Close.

Step 2 - Debug a test

You should notice a dropdown around the middle of the toolbar that has the PyCharm logo on the left and says gaia-ui-tests.
To the right of this is a green right-pointing arrow and to the right of that is a bug symbol with a blue pointing arrow.
You can now run a test by clicking the green arrow or debug a test by clicking the bug symbol.
Because you checked the Show settings checkbox on the configuration, the dialog will pop up allowing you to edit the
configuration before launching the run or debug session. When that happens, the only thing you need to change is the name of the test
file that you wish to run, which is the last thing that you added to the Script parameters: field.
Change that and click Debug (or Run as the case may be), and you'll be off to the races.

Step 3 (Optional) - Have adb forward run automatically before any test

When testing with a real device, you need to make sure that Marionette can communicate with the device via port 2828, so you need to
have forwarded that port at least once after connecting or rebooting a device before you can run a test. We came up with a little trick
to have PyCharm do that for you. To do that, complete the following steps:

Type ctrl + alt + R to open the Run configuration selector.

Type 0, or choose the first option (Edit configurations...) from the select list.

Choose the gaia-ui-tests configuration (which is likely already chosen), which should take you to the
now familiar Run configuration dialog.

Underneath the empty box that says There are no tasks to run before launch click the + sign and
choose Run External tool.

You should see an empty External tools dialog. Click the + sign to add a new tool.

In the Edit Tool dialog, enter the following values:

Name:adb forward

Group:adb

Description:Android Debug Bridge forward

Program:path/to/androidsdk/sdk/platform-tools/adb

Parameters:forward tcp:2828 tcp:2828

Click OK, then OK, then Apply, then Close.

That should be all you need to run and debug gaia-ui-tests from within PyCharm. If you run into any problems with this please feel
free to leave me a comment below.