6

I can't find documentation on whether I should be expecting my Checkpoints to get hit when running unit tests.

I ask because, as you might conclude, I'm not seeing them show up in the Dev Console after a test run. The checkpoint itself shows up, but none of the instances of the dumps show up.

This question hints to the fact that they saw something show up in the Dev Console

But I'm not even getting that far.

3

Yes, they do. I just tested it with an asynchronous test case.

enter image description here

The trick here is you need to have an active TraceFlag with the Apex Code logging level set to Finer or Finest. See Setting Checkpoints in Apex Code.

In the developer console you can check this under Debug > Change Log Levels. Make sure the Expriation on the TraceFlag is green and the Apex Code column is set to Finer.

Active TraceFlag with Finer Apex Code logging.

  • 1
    Thank you -- I have a Partner Portal case open that's been going on for 3 weeks now and no one on their side could spot that rather silly oversight in configuration (Apex log level). That being said, holy unfriendly feature batman, it honestly is almost easier to do println style debugging than to hope you get all the knobs twisted correctly in order to get a checkpoint to work :-( – daveespo Sep 2 '14 at 13:16
  • @daveespo I agree that it isn't the easiest thing in the world to get going. It took me a bit of hunting around to figure out why the checkpoints weren't being generated. I suspect it uses the log output to reconstruct the heap state or figure out the trigger point. Feel free to point the partner portal case here :) – Daniel Ballinger Sep 2 '14 at 19:59
1

In the "Checkpoint" tab in the Developer Console, double click a Checkpoint to enter the Checkpoint Inspector.

via doc: http://help.salesforce.com/apex/HTViewHelpDoc?id=code_dev_console_view_checkpoints.htm&language=en_US

Another option is go to the menu Debug --> Perspective Manager... and select Debug as the Log Perspective. Clicking various points in the Execution Log will have the Variable display (on the right) show what values all of your variables had at that moment in the execution.

A third option is to add System.debug( ... ) statements to your code to perform manual debugging.

  • I'm specifically talking about running Unit Tests -- and as you'll see in this screen shot, I already have it setup as documented but still, no Checkpoints appear when clicking the Run Test button screencast.com/t/KxjAAzLQ. You have gotten this working with a unit test? – daveespo Aug 6 '14 at 22:09
  • Try adding a System.debug(input1); after where your checkpoint is. Then after you run the test, open up the debug log and type in DEBUG in the filter input box – Scott Pelak Aug 6 '14 at 22:24
  • You can add more info to the debug method for instance try System.debug('input1: ' + input1); – Scott Pelak Aug 6 '14 at 22:29
  • I'm sorry, that's not what this question is asking. I know how to do old println style debugging. This question is specifically about the checkpoint feature built into the dev console. I will have to downvote the answer for that reason. – daveespo Aug 7 '14 at 0:19
  • did you read the docs? they spell out everything you should need to know – Scott Pelak Aug 7 '14 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.