is it normal to run a test for 1 min long

22 views
Skip to first unread message

許維城

unread,
Dec 20, 2016, 6:05:16 PM12/20/16
to Illuminated Cloud General Discussion
I'm new to salesforce and illuminated cloud.

Currently, running unit test is painful for me.

It takes one min long for executing a test case.

Sometimes the deployment will also take more than 1 min long.
Any idea to shorten the deploy time?
thanks

    @isTest static void testSample() {
        List<sObject> loan1 = Test.loadData(Loan_Account__c.sObjectType,'aa_LoanAccount');
        ...
    }

Scott

unread,
Dec 20, 2016, 7:34:26 PM12/20/16
to Illuminated Cloud General Discussion
First let's see where the time is being spent.  You can add the following under Help>Debug Log Settings for a detailed debug log of the unit test execution:

#com.illuminatedcloud.intellij.unittest.ApexUnitTestRunProcessHandler

I've seen a few situations recently where unit test runs were taking very long, particularly those that run asynchronously as they're getting placed in a queue with other operations in the same instance/pod.

If you set things up for debug logging as noted above and reproduce these logs test runs, please send me your idea.log which can be found at Help>Show Log in Explorer/Finder and I'll see where the time is going.

Regards,
Scott Wells

許維城

unread,
Dec 20, 2016, 9:37:42 PM12/20/16
to Illuminated Cloud General Discussion
Currently, the time for running unit tests is quicker than before.
It takes about 10secods




Testing started at 6:35 PM ...

Using connection 'CLL-2016-12-07'.

Apex log for TestMintSearchController.testSample
================================================
36.0 APEX_CODE,FINEST;APEX_PROFILING,ERROR;CALLOUT,ERROR;DB,INFO;SYSTEM,FINEST;VALIDATION,ERROR;VISUALFORCE,ERROR;WORKFLOW,ERROR
18:35:49.3 (3894818)|EXECUTION_STARTED
18:35:49.3 (3898878)|CODE_UNIT_STARTED|[EXTERNAL]|01p3600000ITYtp|TestMintSearchController.testSample
18:35:49.3 (4002522)|HEAP_ALLOCATE|[72]|Bytes:3
18:35:49.3 (4057345)|HEAP_ALLOCATE|[77]|Bytes:152
18:35:49.3 (4073882)|HEAP_ALLOCATE|[342]|Bytes:408
18:35:49.3 (4095175)|HEAP_ALLOCATE|[355]|Bytes:408
18:35:49.3 (4115519)|HEAP_ALLOCATE|[467]|Bytes:48
18:35:49.3 (4180411)|HEAP_ALLOCATE|[139]|Bytes:6
18:35:49.3 (4238336)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:15
18:35:49.3 (4283225)|METHOD_ENTRY|[2]|01p3600000ITYtp|TestMintSearchController.TestMintSearchController()
18:35:49.3 (4290377)|STATEMENT_EXECUTE|[2]
18:35:49.3 (4297550)|STATEMENT_EXECUTE|[2]
18:35:49.3 (4314255)|METHOD_EXIT|[2]|TestMintSearchController
18:35:49.3 (4354092)|HEAP_ALLOCATE|[50]|Bytes:5
18:35:49.3 (4394222)|HEAP_ALLOCATE|[56]|Bytes:5
18:35:49.3 (4406058)|HEAP_ALLOCATE|[64]|Bytes:7
18:35:49.3 (4444397)|STATEMENT_EXECUTE|[4]
18:35:49.3 (4446815)|STATEMENT_EXECUTE|[6]
18:35:49.3 (4458954)|HEAP_ALLOCATE|[6]|Bytes:15
18:35:49.3 (4500859)|HEAP_ALLOCATE|[6]|Bytes:14
18:35:49.3 (4538407)|HEAP_ALLOCATE|[6]|Bytes:63
18:35:49.3 (4546304)|SYSTEM_METHOD_ENTRY|[1]|Test.Test()
18:35:49.3 (4548956)|STATEMENT_EXECUTE|[1]
18:35:49.3 (4554811)|SYSTEM_METHOD_EXIT|[1]|Test
18:35:49.3 (4568422)|METHOD_ENTRY|[6]|System.Test.loadData(Schema.SObjectType, String)
18:35:49.3 (8922228)|METHOD_EXIT|[6]|System.Test.loadData(Schema.SObjectType, String)
18:35:49.3 (9020744)|FATAL_ERROR|System.StringException: Unknown field: LOAN_PURPOSE__C

Class.System.Test.loadData: line 53, column 1
Class.TestMintSearchController.testSample: line 6, column 1
18:35:49.3 (9033644)|FATAL_ERROR|System.StringException: Unknown field: LOAN_PURPOSE__C

Class.System.Test.loadData: line 53, column 1
Class.TestMintSearchController.testSample: line 6, column 1
18:35:49.3 (9042963)|CODE_UNIT_FINISHED|TestMintSearchController.testSample
18:35:49.3 (10853220)|EXECUTION_FINISHED

System.StringException: Unknown field: LOAN_PURPOSE__C
Class.System.Test.loadData: line 53, column 1
Class.TestMintSearchController.testSample: line 6, column 1

Scott

unread,
Dec 20, 2016, 9:45:07 PM12/20/16
to Illuminated Cloud General Discussion
That's a pretty strong indication that the issue was a server-side delay.  Feel free to send me your idea.log if you see slow execution time again and I'll let you know what I see.

Regards,
Scott

Robert

unread,
Jan 10, 2017, 5:06:06 PM1/10/17
to Illuminated Cloud General Discussion
Yes. I've had tests that take 8-10 minutes to run or longer. In my case it was not the test themselves that are taking so long. Salesforce would queue up the tests until resources were free. So the test would just sit in queue for 10 minutes and then run. Very annoying. I was able to improve things by disable some of the many batch jobs and scheduled jobs that were running on my instance.
Reply all
Reply to author
Forward
0 new messages