> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/devops-ja/kdo/kdotsru/ai-tesutokurasuno.md).

# AI テストクラスの使用

{% hint style="warning" %}

#### 旧UI向けに作成

この記事は旧UI向けに作成されました。手順は今でも使用できますが、スクリーンショットは古くなっています。場合によっては、手順で参照されている項目が移動または変更されていることがあります。項目が見つからない場合は、 [どこに行ったのか](/devops/devops-ja/shii-uiux-heno/dokonittanoka.md) 記事。
{% endhint %}

## ![](https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) 概要

この記事では、AI Test Class Creator を使用して、選択したコンポーネントの Salesforce テストクラスを自動生成する方法を説明します。生成後は、テストクラスを確認し、ブランチに新しいコンポーネントとしてコミットできます。

Salesforce にコンポーネントをデプロイするには通常、十分なテストカバレッジが必要なため、AI Test Class Creator は次の方法でテストカバレッジの確保を加速します。

* 不足しているテストカバレッジを追加することで、デプロイの準備を改善します。
* 不十分なテストや失敗するテストによるデプロイ失敗を減らします。
* チーム間でベースラインのテストパターンを標準化します。
* 手動でのテスト用ひな形作成の手間を減らし、デリバリーを加速します。

{% hint style="info" %}

#### デフォルトのAI制限

デフォルトでは、FlosumはDeepSeekのAPIを通じて、DevOps向けに無料の共有DeepSeek AIモデルを提供します。これはテナント間で共有されているため、パフォーマンスと可用性はシステム負荷とトークン容量に依存します。使用が集中すると、遅延が大きくなったり、一時的なエラーが発生したりする場合があります。これを回避するには、独自のカスタムAIモデルを追加できます。次の記事を参照してください。

* [カスタム AI モデルの追加](/devops/devops-ja/she-ding/ai-she-ding/kasutamu-ai-moderuno.md)
  {% endhint %}

{% hint style="info" %}

#### ベストプラクティス

* 生成されたテストデータの設定を確認し、組織の検証ルールと必須項目に一致していることを確認してください。
* テストクラスがチームの命名規則とデプロイ基準に従っていることを確認してください。
* 可能であれば、変更内容の確認と追跡を容易にするために、テストクラスは個別にコミットしてください。
  {% endhint %}

## AI Test Class の使用

{% stepper %}
{% step %}

### ブランチとコンポーネントを選択する

1. クリック **コード** を左側のサイドバー メニューから。
2. テストクラスを作成したいコンポーネントが含まれているブランチをクリックします。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FjPY9ZPXse212SeXyIT0f%2FUsingAiTestClass-S01-01.png?alt=media&amp;token=da2cef93-ebd4-4332-8cc7-2d2eaac9be0e" alt="" width="563"><figcaption></figcaption></figure></div>
3. テストクラスを作成したいコンポーネントをクリックします。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2Fjza6xctU6Ga9NXqT9JnJ%2FUsingAiTestClass-S01-02.png?alt=media&amp;token=80ddce1e-e06e-4558-9165-41c9def68bc6" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### テストクラスを作成

{% hint style="info" %}
生成されるテストクラスは、コンポーネント名に「**Test**」を追加した名前になります。
{% endhint %}

1. クリック **AI ツール** の横の **編集**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FHSjGxQiwNMWzBKEu5KuC%2FUsingAiTestClass-S02-01.png?alt=media&amp;token=eaef1f22-c3e1-4745-b0f4-7713f33e7e64" alt="" width="563"><figcaption></figcaption></figure></div>
2. クリック **AI Test Class** ドロップダウン メニューから。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FI6PpJOWQlLleUqsxFuCs%2FUsingAiTestClass-S02-02.png?alt=media&amp;token=6b41dee3-7c23-41c7-b7dc-2a8541299188" alt="" width="563"><figcaption></figcaption></figure></div>
3. テストクラスの生成中は、 **AI が生成中...** が表示されます。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FCMgJYvojkGCPcVmI64aO%2FUsingAiTestClass-S02-03.png?alt=media&amp;token=33c762c0-193b-4e41-8997-4ebfd30c1ab4" alt="" width="563"><figcaption></figcaption></figure></div>
4. 作成後にテストクラスを確認し、必要に応じて変更を加えます。
5. クリック **変更をコミット**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FoNg9miCVV6LrAaDY9Mi5%2FUsingAiTestClass-S02-04.png?alt=media&amp;token=936375d1-853d-4dc2-baf1-69e6b5f99c98" alt="" width="563"><figcaption></figcaption></figure></div>
6. を入力してください。 **コミット メッセージ** をテキストボックスに。
7. クリック **コミット**.

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FPoDhJwlqO0OHel5v9sQ4%2FUsingAiTestClass-S02-05.png?alt=media&amp;token=3c3a80d3-0794-40d1-bfad-cd157681fdd6" alt="" width="563"><figcaption></figcaption></figure></div>
8. 作成されると、新しいテストクラスは新しいコンポーネントとしてブランチに追加されます。

   <div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FtU889BsBCIFCDTmTqXWX%2FUsingAiTestClass-S02-06.png?alt=media&amp;token=da92f88a-70cf-422a-ba3f-7998fcc561dc" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/devops-ja/kdo/kdotsru/ai-tesutokurasuno.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
