I'm running unit tests in Eclipse (Force.com IDE) and they are taking 5min+ to execute. Is there an alternative way to run them, or are there tips to speeding this up? I know I can run the tests from the setup menu GUI, but it doesn't seem to give the same detailed messages and debug logs as the IDE.

8 Answers 8


If you run your tests from the setup menu GUI, you should be able to get the same logs as via Force.com IDE if you have Developer Console open whilst you run your tests. See this post for info about using Developer Console for logging:

*** Skipped 7397754 bytes of detailed log - Is there a way we can we get the full log?

I do find this method quicker than waiting for the IDE but I always get frustrated trying to edit code in the browser.

To see which lines were/were not tested see the 'Overall Code Coverage' panel on the top right, double click the class you're interested in and you'll see the output below:

enter image description here

  • 1
    Thanks. After opening the Dev Console I noticed you can actually run the tests from there and they are executing about 10x faster (about 20-30 seconds compared to 5min+)! This is a huge help. Do you know if it's possible to get a list of which lines did not pass in the Dev Console, the way it prints out in the IDE? That's pretty important functionality for me and I don't that in the logs or anywhere else.
    – paul
    Commented Oct 25, 2012 at 5:14
  • 1
    Hi @paul - I've edited my original answer to include a screenshot. There's actually much more to Dev console testing than I'd realised, good spot! Commented Oct 25, 2012 at 6:43
  • I've noticed that the 'Overall Code Coverage' in the dev console does not match the code coverage results in eclipse. This might be because the console version is counting blank lines differently than the IDE, but it seems like it's less accurate and the IDE has the correct results.
    – paul
    Commented Nov 1, 2012 at 21:27
  • You can get the full test log by adding yourself to the debug log tracker - Setup > Monitoring > Debug Log. You can also change the debug log level to get less data which may make it run faster. This article was helpful bit.ly/QrREfz - For now this is my preferred method of running unit tests, but it's hard to pick a solution here because there are multiple valid ways of speeding up unit tests over the IDE.
    – paul
    Commented Nov 2, 2012 at 18:22

I'd second the other answers in trying other methods of executing the unit tests outside of Eclipse. Also, explore if the test cases are just slow by their nature or quantity.

I don't know why, but sometimes Eclipse just seems to hang when running unit tests for me (and often when saving files). It's like the test has finished running in Salesforce ages ago but there is a significant delay before Eclipse picks up that is has completed and displays the results.

It got so bad that I had time to build my own tool to run the test cases using the Salesforce APIs. You can get the FuseIT SFDC Explorer for free (Windows only at this stage).

Once you have logged in go to Apex Tests tab in the bottom left. Then enter a filter for the classes you want to test and hit Search. The checked test classes than then be run either synchronously or asynchronously.

Changing the Logging Levels to Warn, Error, or None can greatly reduce the size of the log file that gets created and displayed.

I'm still tinkering with it, but hopefully it is helpful if Eclipse is slowing you down in the testing department.

Running Salesforce Test classes

Blatant rip-off of the excellent xkcd...

Are you building an alternative IDE? Yeah, but I'm doing it while my code unit tests.

I noticed recently that there is a Force.com IDE Log Viewer in Eclipse (Help > Show Force.com IDE Log). It might provide some more clues as the why the IDE is hanging.

Force.com IDE Log Viewer

  • Thanks for this, Daniel! I second your observation with the IDE slowing down. I had to stop using it to run unit tests on some projects as it would spike the CPU regardless of how much heap space or other configurations I put in my eclipse.ini. Commented Oct 25, 2012 at 0:34
  • Thanks, this looks cool. I tried it and got an error "UNKNOWN_EXCEPTION: admin operation already in progress"; "The tests could not be run. Please use a Salesforce account with permission to run apex tests." Of course, I have been running tests with my account.
    – paul
    Commented Oct 25, 2012 at 4:20
  • I'm giving you a point for the awesome re-use of XKCD Commented Oct 25, 2012 at 14:06
  • @paul I believe that error message occurs when the org has been locked due to other admin tasks currently in progress. E.g. A class is currently being saved and compiled. Give it a minute and try again. The second message is a generic one I raise when the test fails to run. In this case it probably isn't applicable. Commented Oct 25, 2012 at 18:58
  • This question has been open a long time. Unfortunately, due to my open-ended question, there's no right answer. This answer is as good as the one I chose, but I chose the other because going with the Developer Console: (a) uses native Salesforce functionality instead a third party app that may not always be supported, (b) is very fast, (c) is how prefer to do it. I still think Eclipse offers the best interface for running tests and the most accurate results and prefer to use it when I can, but when it's hanging the dev console is fast and easy.
    – paul
    Commented Jan 22, 2013 at 21:57

Mavens Mate plugin for SublimeText2 is my preferred unit test runner.

  • Didn't even know of this tool. Installed it today. Just great. And yes, it runs tests much, much faster than the IDE Commented Oct 25, 2012 at 7:13
  • 2
    I've heard great things. Sadly only Mac Supported Commented Oct 25, 2012 at 14:07

I put together a simple java sample which shows you how to write your own test runner from the command line. I've used it when the IDE locks up.



For my use case setting the Log-Level to WARN or ERROR as increased the speed from about 2 minutes to only 3 seconds. In works in Developer Console as well as in eclipse. However finding the right settings in eclipse, caused me some hick-ups:

Speedup Testing with Force.com IDE using slim Logs - but how to set the log-level?

This will not speed up or can be used for all possible use cases. But it's worth a try!


I don't necessarily have a good way to speed up unit tests, but I would like to quickly share an article a co-worker of mine found that my company has used to set up scheduled unit test runs nightly.


We took this article as inspiration and tweaked it rather significantly, but the end goal was getting unit tests running nightly. The reason for this is that on the scale of some of our projects, a full unit test run through takes upwards of 40 minutes. The ridiculous amount of data model that needs to be built really hinders some of the things we have tried to do. Some of our unit tests require up to 50 unique object types to be built up. This causes significant performance issues and thus increases time the unit tests run. Allowing these unit tests to run as a whole at night allows the developers to not run all of the unit tests constantly (although this is NOT ideal in true TDD). Unfortunately, time constraints are a reality on many projects.

I would suggest setting this up in your development environment but also set it up in production orgs as well. Being able to see if an administrative change (such as adding new required field validation) will break your unit tests every night is invaluable and saves time when it comes closer to deploy.

  • 2
    I should have added, the #1 way to increase unit tests would be for Salesforce to introduce mocks. Until mocking is introduced, what we are really writing are integration tests which usually take significantly longer to run. Being able to write mocks would help unit test times tremendously. Commented Oct 25, 2012 at 15:07

Maybe try the Force.com Migration tool to invoke the test methods, so you can do it programmatically in the background. Besides the GUI and the meta-data api there aren't many other options. And the IDE is just a wrapper for the metadata api.

How many test-methods are you running?


5 minutes is not a lot, relative to the number of Test Classes you are running.

It might be an idea to look through the debug logs (for time stamps) or even trying to run culprit tests that you think might be hogging the time, individually, to isolate the performance hoggers.

Some common sense best practices would be to externalise creation of setup test data to a reusable method in a utility class, and structure tests such that you are justifying the cost of creates with sufficient assert statements and grouping related asserts together rather than recreating data each time.

If however the test times are down to the sheer processing, then it would be harder to optimise run times. A few ideas

Use Test.isRunningTest to check if a test is running and use that switch to make any performance optimisations that you think you can afford, for eg. A mock response if that isn't subverting the unit test

Do not use SeeAllData=true and create your own test data. This is particularly relevant to classes which may be firing soql queries and processing data. They should only be processing data inserted in the test rather than any static data in your sandbox.

  • 5 minutes is a lot when it comes to the idea of unit testing. If you don't run your test after every testcase, you are doing it wrong. Having 5 minute unit test cycles means you have to wait 5 minutes every few minutes.
    – David
    Commented Feb 9, 2023 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .