本番環境へのリリース時にパフォーマンスの問題が発生した場合は、コードをリリースする前にすべてのテストを実行していることにより、パフォーマンスに影響が出ている可能性があります。リリース速度が遅い特定の理由はありませんが、クラスの複雑さやクエリのパフォーマンスなど、いくつかの要因がパフォーマンスに影響する可能性があります。
1.クエリの最適化を検討します。常に WHERE 句を使用し、データの比較的小さなサブセットを調べるようにします。
2.テストクラス: クエリではなくオブジェクトを使用します。
例:
トロントの取引先リストが必要だとします。
以下を実行するのではなく、
Account acc = [Select name from Account where site=’Toronto’];
List accList = new List(); Account acc; For (int i=0 ; i
3.一括処理クラス: これらをテストするには時間がかかる場合があります。 一括処理クラスがある場合は、このクラスには「startTest」と「stopTest」のメソッドがあることをご存じでしょう。一括処理クラスごとに 1 つのテストクラスを使用するのではなく、すべての一括処理クラスに対して 1 つの startTest/stopTest メソッドを使用することをお勧めします。
4. テストクラスでオブジェクトが必要になるたびに新しいオブジェクトを作成するのではなく、オブジェクトのインスタンスを作成することだけを目的とした静的クラスを作成します (「getNewAccount()」や @testSetup の使用など)。テスト設定メソッド (@testSetup でアノテーションされたメソッド) は、テストレコードを一度作成し、テストクラスのすべてのテストメソッドでテストレコードにアクセスするために使用されます。
詳細は「セレクティブ SOQL クエリを使用するカスタムインデックスによるパフォーマンスの向上」方法を参照してください。
000384936

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.