Apexクラスにトリガのテストメソッドを作成する際、トリガイベントとして before update を使用しています。
テストメソッドは既存のレコードに対して update を行うコードを書いて確認するものなのでしょうか。
それとも、テストメソッドの中で新規レコードの作成 (insert) を行い、そのレコードに対して update を行って確認するものなのでしょうか。
テストメソッド内にて、新規レコードを insert し、そのレコードに対して update を行う方法を推奨します。
その理由としては、Sandbox上の実データを使用してテストメソッドを実行することも可能ですが、運用組織側にデプロイする際にテストメソッド内で使用した実データと同様のデータが運用組織に存在しない場合に、エラーとなるためです。
そのためテストメソッド内にて擬似データを insert し、そのレコードに対して update 処理を実行してテストを行ってください。
参考情報:
テストの例
Test クラス
000385331

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.