

kinkun's blog
테스트 클래스 실행 시 “Failed to run tests synchronously.: Your query request was running for too long.” 오류 대응
Summary
Test classes failing with QUERY_TIMEOUT Failed to run tests synchronously when running in synchronous mode
Login to the org which has quite number of managed package apex classes.
Run the Apex Test Class from Developer Console in Sync Mode
You may notice below exception when running the apex test class:
Error Message:
“QUERY_TIMEOUT Failed to run tests synchronously: Your query request was running for too long”
Workaround
As a workaround, please try to run the test class in asynchronous mode.
Handling the error “Failed to run tests synchronously.: Your query request was running for too long.” when running a test class
Summary
Test classes failing with QUERY_TIMEOUT Failed to run tests synchronously when running in synchronous mode
Login to the org which has quite number of managed package apex classes.
Run the Apex Test Class from Developer Console in Sync Mode
You may notice below exception when running the apex test class:
Error Message:
“QUERY_TIMEOUT Failed to run tests synchronously: Your query request was running for too long”
Workaround
As a workaround, please try to run the test class in asynchronous mode.
SOQL 문의 HAVING
HAVING에서는 GROUP BY로 그룹화한 결과에 대해 좁혀 조건을 넣을 수 있습니다.
좁힌 조건이라는 의미에서는 WHERE와 비슷하지만, WHERE에서는 그룹핑하기 전, HAVING은 그룹핑한 후입니다.
다음 샘플은 기회의 리드 소스로 그룹화하고 동일한 값의 레코드 수가 1 이상인 리드 소스별 금액을 표시합니다.
AggregateResult[] results = [SELECT LeadSource, SUM(Amount) summary
FROM Opportunity
GROUP BY LeadSource
HAVING Count(LeadSource) > 1];
for(AggregateResult ar: results){
System.debug('LeadSource='+ ar.get('LeadSource')
+ ':Amount='+ ar.get('summary'));
}
디버그 결과
LeadSource=LeadSource1:Amount=2
LeadSource=LeadSource2:Amount=3
SOQL statement HAVING
HAVING allows you to enter filtering conditions for the results grouped by GROUP BY.
It is similar to WHERE in that it is a filtering condition, but WHERE is before grouping and HAVING is after grouping.
The following sample groups by the lead source of the opportunity and displays the amount by lead source where the number of records with the same value is 1 or more.
AggregateResult[] results = [SELECT LeadSource, SUM(Amount) summary
FROM Opportunity
GROUP BY LeadSource
HAVING Count(LeadSource) > 1];
for(AggregateResult ar: results){
System.debug('LeadSource='+ ar.get('LeadSource')
+ ':Amount='+ ar.get('summary'));
}
Debugging Results
LeadSource=LeadSource1:Amount=2
LeadSource=LeadSource2:Amount=3
ジョセフ・マーフィー
集中しなければならないときは、
注意をそらすことがかならず起こる。
だから、それをあらかじめ予測し、対応しよう
カール・ルイス
自分でコントロールできないことを排除して、
できることの集中するんだ。
ピーター・ドラッカー
効果的な経営者の共通点は、
ひたすらひとつの作業に集中する点にある。
彼らは最も大切なことのみ行い。
そのことが完了するまで、
他の事に目を向けないという集中力を持っている。
Visual Studio Codeでsfdx一覧表示とログイン
メニュー > ターミナル
・sfdx一覧表示するコマンド
sfdx force:org:list
・sfdxログインコマンド
sfdx force:org:open -u test@test.test