---
sourceDocument: Xanadu IT Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/it-service-management

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# DevOps テストツール統合

# DevOps テストツール統合 {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：9分

テストツール統合により、Jenkins、Azure DevOps、GitHub、GitHub Enterprise、およびGitLabの単体テスト、機能テスト、およびパフォーマンステストのテスト結果をDevOpsで表示できます。

GitLab と Jenkins では、JUnit テストタイプの統合のみがサポートされています。  
注:  
その他のテストタイプの場合は、[DevOps](https://www.servicenow.com/docs/access?context=devops-api&version=xanadu&pubname=xanadu-api-reference&ft:locale=en-US)[API の DevOps - POST /devops/tool/{capability}](https://www.servicenow.com/docs/access?context=devops-api&version=xanadu&pubname=xanadu-api-reference&ft:locale=en-US) エンドポイントを使用します。  
* TestNG を使用して実行および公開された Selenium テストは、ServiceNow DevOps 用の Jenkins プラグインによって報告されます。
* テストタイプの分類がサポートされています。
* Apache JMeter などのツールによって報告された追加のテスト結果は、カスタムワークフロースタジオサブフローを使用して DevOps で処理できます (パイプラインの変更は必要ありません)。
{#dev-ops-test-tool-integration__ul_bkq_dq5_pnb}  
{#dev-ops-test-tool-integration__table_xxq_lcx_pnb__entry__2}

| カテゴリ | テストタイプ |
|-|-|
| Unit (単位) | JUnit (デフォルト) NUnit XUnit 単体テスト 注: * GitLab および Jenkins では、JUnit テストタイプの統合のみがサポートされています。 * ADO、GitHub、および GitHub Enterprise では、JUnit、NUnit、XUnit、および単体テストタイプの統合がサポートされています。 {#dev-ops-test-tool-integration__ul_cyb_gdj_b1c} デフォルトのテストタイプを変更するには、 \[sn_devops.default_test_type\] [DevOps プロパティ](https://servicenow-prod.fluidtopics.net/pGadTkrEFK7QVsytbZR8Xg "これらのプロパティを使用して、 DevOps チェンジベロシティ アプリケーションの設定を構成します。"). |
| 機能的 | * データ連携 * 回帰 * 煙 * システム * ユーザー受理 {#dev-ops-test-tool-integration__ul_nnl_mcx_pnb} |
| パフォーマンス | Load |
[ ]

{#dev-ops-test-tool-integration__table_xxq_lcx_pnb}

## テストタイプマッピング {#dev-ops-test-tool-integration__section_opj_n5l_vlb}

テストタイプマッピングは、テストタイプとテスト対象のエンティティを DevOps ツール (DevOps統合テストタイプマッピング モジュールです。

正確なテストタイプマッピングにより、テストタイプがテストサマリー結果に常に意図したとおりに表示されます。  
{#dev-ops-test-tool-integration__table_j2s_nkv_pnb__entry__2}

| Field (フィールド) || Description (説明) |
|-|-|-|
| テストタイプ || * JUnit * データ連携 * 回帰 * 煙 * システム * ユーザー受理 * Load {#dev-ops-test-tool-integration__ul_jyw_xkv_pnb} |
| DevOps エンティティ ID | テーブル名 | DevOps (テストレポートペイロード内の) テスト結果にリンクされたエンティティを含むテーブル名。 * ステップ \[sn_devops_step\] * パイプライン \[sn_devops_pipeline\] {#dev-ops-test-tool-integration__ul_sy5_4mv_pnb} 注: DevOpsステップテーブルとパイプラインテーブルのみがサポートされています。 |
| DevOps エンティティ ID | ドキュメント | 選択したテーブルで指定されたエンティティの名前。 たとえば、ステップ、パイプライン、アーティファクト、パッケージの名前などです。 |
| テストファイルパス (Jenkins テストのみ) || Jenkins サーバー上で生成されたテスト結果ファイルへのパス。 これは、JUnit や TestNG の実装に準拠しない属性 (たとえば JMeter など) を持つテストレポートを DevOps で活用できるようにするために便利です。 複数のファイルはカンマで区切ります。 注: 生のテストペイロードを変換するには、 ワークフロースタジオ サブフローを使用する必要があります。 |
| ツール統合 || テストを実行しているツール。 |
| DevOps テーブル || DevOpsDevOps エンティティ ID 設定のテーブル名に対応するテーブル。 |
[ ]

{#dev-ops-test-tool-integration__table_j2s_nkv_pnb}  
図 : 1. DevOps テストタイプマッピング  
図 : 2. ADO 単体テストの yaml ファイルの例 図 : 3. GitHub 単体テストの yaml ファイルの例

## 生のテストペイロードの変換 {#dev-ops-test-tool-integration__section_evb_tzv_pnb}

たとえば、カスタムサブフロー (ディシジョンテーブルディシジョンテーブル モジュール)。  
注:  
生のテストペイロードを変換するカスタム ワークフロースタジオ サブフローを作成する必要があります。

パフォーマンスステージに複数のテストタイプがある場合は、 DevOps テストタイプポリシー ディシジョンテーブルを使用して各テストのテストタイプを構成し、テスト結果のペイロードが正しく変換されるようにすることができます。  
図 : 4. DevOps ディシジョンテーブル  
{#dev-ops-test-tool-integration__table_c54_kcw_pnb__entry__3}

| ディシジョンテーブル | 目的 | 構成 |
|-|-|-|
| DevOps テストサブフローポリシー | ツールが受信した生のペイロードを変換するカスタムサブフローを自動的に呼び出すこと。 意思決定の入力： * テスト結果ペイロード * 検査タイプ {#dev-ops-test-tool-integration__ul_wxg_2dw_pnb} | 生のペイロードを受信したときに呼び出すカスタムサブフローを指定する意思決定を作成します。 生のペイロードに含まれるフィールドを含む条件を設定します。 たとえば、BZ パフォーマンステスト Jenkins カスタムサブフローを呼び出すには、次のようにします。 Conditions : * <kbd class="ph userinput">テストタイプは [ロード] です</kbd> (負荷は、パフォーマンステスト用に構成されたテストタイプです) * <kbd class="ph userinput">テスト結果ペイロードにスループットが含まれています</kbd> * <kbd class="ph userinput">テスト結果ペイロードに同時実行が含まれている</kbd> {#dev-ops-test-tool-integration__ul_jrv_x2w_pnb} 解答:フロー: Jenkins BZパフォーマンステスト |
| DevOps テストタイプポリシー | パフォーマンステストステージに複数のタイプのテストが構成されている場合に、テストタイプを自動的に設定すること これは、2 番目のテストタイプの結果を正しく変換するために必要です。 たとえば、ロードパフォーマンステストと JUnit パフォーマンステストの両方が同じ DevOps ステップでマップされている場合、決定が作成されない限り、JUnit テスト結果は正しくフォーマットされません。 意思決定の入力： * ステップ * テスト結果ペイロード * ツール統合 * Pipeline (パイプライン) {#dev-ops-test-tool-integration__ul_dkm_sjw_pnb} | テストタイプを設定するために、パフォーマンステストステージの各タイプのテストに対する意思決定を作成します。 負荷テスト: * Conditions : * <kbd class="ph userinput">ステップはパフォーマンステストです</kbd> * <kbd class="ph userinput">テスト結果ペイロードにスループットが含まれています</kbd> * <kbd class="ph userinput">テスト結果ペイロードに同時実行が含まれている</kbd> {#dev-ops-test-tool-integration__ul_r5g_2kw_pnb} * 解答: <kbd class="ph userinput">TestType:ロード</kbd> {#dev-ops-test-tool-integration__ul_fvh_tpw_pnb} JUnit テスト: * Conditions : * <kbd class="ph userinput">ステップはパフォーマンステストです</kbd> * <kbd class="ph userinput">テスト結果ペイロードにスループットが含まれていません</kbd> * <kbd class="ph userinput">テスト結果ペイロードに同時実行が含まれていません</kbd> {#dev-ops-test-tool-integration__ul_lx1_5qw_pnb} * 解答: <kbd class="ph userinput">TestType:JUnit</kbd> {#dev-ops-test-tool-integration__ul_kx1_5qw_pnb} |
[表 : 1. DevOps ディシジョンテーブル]

{#dev-ops-test-tool-integration__table_c54_kcw_pnb}  
図 : 5. DevOps 複数のパフォーマンステストタイプ  
図 : 6. DevOps 複数のテストタイプマッピング  
図 : 7. DevOps ディシジョンテーブルの決定

## テストサマリー結果 {#dev-ops-test-tool-integration__section_iq3_11v_pnb}

テストサマリーの結果は、次の方法で表示できます。

* DevOpsテスト結果 モジュール (テストサマリとパフォーマンステストサマリ)。
* [\[DevOps 変更要求](https://servicenow-prod.fluidtopics.net/PewgmoIzDmnYrtTZcvM5xQ "パイプラインで変更要求を自動的に作成するために DevOps チェンジベロシティ の変更の促進機能を有効にし、変更承認フローとポリシーを使用して特定の条件下で承認を自動化します。") :テスト結果\] 関連リスト。
* [DevOps パイプライン UI](https://servicenow-prod.fluidtopics.net/WJq2HvvtdO6vYifGEGxPxQ "パイプライン UI を使用して、パイプライン実行全体のインタラクションと結果を可視化します。このグラフィカル ビューには、各パイプラインのパイプライン ステップの進行状況とその他の詳細が表示されます。") - 高品質のタイル。
{#dev-ops-test-tool-integration__ul_ayj_jd4_vlb}  
図 : 8. DevOps パフォーマンステストサマリーの例

## 想定される標準 JSON 通知機能ペイロード:テストツール {#dev-ops-test-tool-integration__section_ey3_fyn_qnb}

機能的な：

    { 
    "name": "CorpSite-selenium#55", 
    "duration": 78.802, 
    "passedTests": 4, 
    "failedTests": 0, 
    "skippedTests": 0, 
    "blockedTests": 0, 
    "totalTests": 4, 
    "startTime": "2020-06-30T18:12:31Z", 
    "finishTime": "2020-06-30T18:12:31Z", 
    "passingPercent": 100, 
     
     
    // Use Artifact OR Package OR Build + Stage + PipelineName Attributes 

    Send only one Attribute combination. For example, send Attributes of either  Artifact or Package, or the combination of Build + Stage + PipelineName.

    If you send more than one Attribute, priority is given in the following order and the low priory one is ignored. For example, if you send attribute for both packages and artifacts, then attribute of package is considered and the attribute of artifacts is ignored.

    1.packages
    2.artifcats
    3.buildNumber + stageName + pipelineName

    "packages": [{"name": "CorpSite-pkg1"}], 
    "artifacts": [{"name": "CorpSite-artifact", "version": "1.0.0"}], 
    "buildNumber": "55", 
    "stageName": "test", 
    "pipelineName": "CorpSite-selenium", 
    } 

    Notes:
    - The pipelineName attribute value must be same as the value in the Orchestration pipeline field of the Pipeline [sn_devops_pipeline] table.
    - The stageName attribute value must be same as the value in the Orchestration stage field of the Step [sn_devops_step] table.

パフォーマンス：

    { 
    "name": "Performance Tests", 
    "url": "http://abc.com", 
    "startTime": "2020-06-30T18:12:31Z", 
    "finishTime": "2020-06-30T18:12:31Z", 
    "duration": 78.802, 
    "maximumVirtualUsers": "", 
    "throughput": "", 
    "maximumTime": "", 
    "minimumTime": "", 
    "averageTime": "", 
    "ninetyPercent": "", 
    "standardDeviation": "", 
     
    // Use Artifact OR Package OR Build + Stage + PipelineName Attributes 

    Send only one Attribute combination. For example, send Attributes of either  Artifact or Package, or the combination of Build + Stage + PipelineName.

    If you send more than one Attribute, priority is given in the following order and the low priory one is ignored. For example, if you send attribute for both packages and artifacts, then attribute of package is considered and the attribute of artifacts is ignored.

    1.packages
    2.artifcats
    3.buildNumber + stageName + pipelineName

    "packages": [{"name": "CorpSite-pkg1"}], 
    "artifacts": [{"name": "CorpSite-artifact", "version": "1.0.0"}], 
    "buildNumber": "55", 
    "stageName": "test", 
    "pipelineName": "CorpSite-Performance", 
    } 

    Notes:
    - The pipelineName attribute value must be same as the value in the Orchestration pipeline field of the Pipeline [sn_devops_pipeline] table.
    - The stageName attribute value must be same as the value in the Orchestration stage field of the Step [sn_devops_step] table.

* **[でのテストツールの構成 DevOps](https://servicenow-prod.fluidtopics.net/1E3KGVT954CAxiM1Tn2YsQ)**   
  DevOps でテストツールを構成して、単体テスト、機能テスト、およびパフォーマンステストの結果を表示します。
* **[テスト API を使用してテスト結果を変更要求に追加する](https://servicenow-prod.fluidtopics.net/dJ2Cmstno6MigLsofZ893g)**   
  DevOps - POST /devops/tool/{capability} API のテスト機能を使用して、 DevOps 変更要求にテスト結果を追加します。API は、 DevOps チェンジベロシティ に接続されているさまざまなツールのすべてのテストタイプで使用できます。
* **[添付ファイル API を使用して添付ファイルを変更要求に追加](https://servicenow-prod.fluidtopics.net/j2SyF2vDk5FtnxVAze37lw)**   
  添付ファイル API を使用して、テストレポート xml を DevOps 変更要求に添付ファイルとして追加します。

