1

I just upgraded when I saw the opportunity to do Apex Unit Test configurations (to make testing as easy as clicking the "Play" button). What I've found, though, is that when the tests run, they run on the server-side version of the code, which defeats the purpose since I can't make changes locally and test them.

Here's some evidence: 1) I put System.AsssertEquals(1, 2); and it's still passing 2) I created a new test method locally and chose it as an option for "Test method" in the "Run Configurations" popup, but when I run it, it gives the warning "Method asdfadfasd does not exist in the the apex class with Id :01po0000004o54e"

Am I missing something obvious here to be able to test local unit tests? I'm trying to find a rapid way to do unit tests without having to deploy to the server (which requires running all my unit tests and thus takes forever).

Any help is appreciated!

2 Answers 2

0

That feature simply creates a preset list of tests to run (along with defined logging levels) for a given configuration. It still runs them on the server. It just makes it easier to run a group of tests that you may need to run to test things frequently

maybe you are thinking of Apex Debugger? That is a paid feature..

Currently there is no "Local" version of Salesforce to run anything against.

4
  • Hmm so what I don't understand is if there's any way I can rapidly develop new unit tests by running them as I go and seeing if they succeed/fail? Right now my process is to make my changes to the unit test, click "Save to Server", and wait for ALL the unit tests to run (which takes several minutes) to see if mine succeeds or fails. But all I want to do is run just the one test I'm developing and not the entire set. Am I missing something or when folks develop unit tests, they're used to waiting 5-10 minutes for all tests to run in order to see the results of the current one? Commented Oct 28, 2015 at 23:21
  • @DavidMurray - Are you deploying to production? If so you should be doing it via a sandbox where the unit tests are not run. Also, there is a new deploy option to "Run No Tests" if you are doing this in production although I do not know where to set it in the IDE. Save to server if in sandbox does not run unit tests normally
    – Eric
    Commented Oct 28, 2015 at 23:35
  • I was indeed, because I usually make small changes, so it saved me time to do so. It would be nice if the Force.com IDE gave feedback that the unit tests will not run based on the local content when connected directly to production! :) I just switched my configuration to Sandbox and noticed that now the unit tests go off what I have locally, so looks like this was the issue. Thanks! Commented Oct 28, 2015 at 23:40
  • @DavidMurray - Once you are done testing, you can deploy it directly from the IDE to production, but doing it in sandbox will save a lot of deployment time.
    – Eric
    Commented Oct 28, 2015 at 23:41
0

You said:

I'm trying to find a rapid way to do unit tests without having to deploy to the server (which requires running all my unit tests and thus takes forever).

I'm not entirely sure what you mean but I think you want Apex Test Execution.

2
  • I'm talking about the Force.com IDE, so not that link which is in the SFDC UI, but thanks for the prompt reply anyway. Commented Oct 28, 2015 at 23:30
  • @DavidMurray The Force.com IDE is just an IDE, not a compiler. This was my major disappointment when I started this world, also. All code is compiled and run in Salesforce, not locally. Commented Oct 29, 2015 at 14:28

You must log in to answer this question.

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