Where can I read the debug output of test classes

Suppose I have a test class TestClassName.

private class TestClassName {
static testMethod void testMethodName() {
        System.debug('My debug statement');
        System.assertEquals(1, 1);

Where can I find the log that has the 'My debug statement' output?

It seems that:

  • Force.com shows the log of the actual ClassName class
  • Developer console shows the log of the actual ClassName class
  • Debug Logs doesn’t show the logs of the TestClassName test class
  • Apex Test Execution doesn’t show any logs


When you run your test class the debug log does show the logs of even your test execution.

You have to find the user that started the test in question. The user can be found by going to Setup > Develop > Apex Test Execution and inspecting the Test run to find the email of the user.

The line will look like this:

Test run: yyyy-mm-dd hh:MM:ss, user@organization.com (n class[es])

Then at Setup > Monitoring > Debug Logs add the user who has the user@organization.com email to Monitored Users.

 07:54:37.375 (2375302000)|EXECUTION_STARTED
 07:54:37.375 (2375362000)|CODE_UNIT_STARTED|     [EXTERNAL]|01p90000002IZE6|TestClassName.testMethodName
  07:54:37.376 (2376542000)|METHOD_ENTRY|   [2]|01p90000002IZE6|TestClassName.TestClassName()
 07:54:37.376 (2376557000)|METHOD_EXIT|[2]|TestClassName
 07:54:37.376 (2376695000)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY)
  07:54:37.376 (2376721000)|USER_DEBUG|[4]|DEBUG|My debug statement
  07:54:37.376 (2376731000)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY)
  07:54:37.376 (2376752000)|SYSTEM_METHOD_ENTRY|[5]|System.assertEquals(ANY, ANY)
  07:54:37.376 (2376776000)|SYSTEM_METHOD_EXIT|[5]|System.assertEquals(ANY, ANY)
   07:54:35.608 (2376798000)|CUMULATIVE_LIMIT_USAGE
   Number of SOQL queries: 0 out of 100
   Number of query rows: 0 out of 50000
   Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
   Number of code statements: 2 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
 Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
 Number of picklist describes: 0 out of 100
 Number of future calls: 0 out of 10


07:54:37.376 (2376826000)|CODE_UNIT_FINISHED|TestClassName.testMethodName
07:54:37.376 (2376835000)|EXECUTION_FINISHED

Source : Link , Question Author : ipavlic , Answer Author : ipavlic

Leave a Comment