DevOps テストツール統合
テストツール統合により、Jenkins、Azure DevOps、GitHub、GitHub Enterprise、およびGitLabの単体テスト、機能テスト、およびパフォーマンステストのテスト結果をDevOpsで表示できます。
GitLab と Jenkins では、JUnit テストタイプの統合のみがサポートされています。
- TestNG を使用して実行および公開された Selenium テストは、ServiceNow DevOps 用の Jenkins プラグインによって報告されます。
- テストタイプの分類がサポートされています。
- Apache JMeter などのツールによって報告された追加のテスト結果は、カスタムワークフロースタジオサブフローを使用して DevOps で処理できます (パイプラインの変更は必要ありません)。
| カテゴリ | テストタイプ |
|---|---|
| Unit (単位) | JUnit (デフォルト) NUnit XUnit 単体テスト 注:
デフォルトのテストタイプを変更するには、 [sn_devops.default_test_type] DevOps プロパティ. |
| 機能的 |
|
| パフォーマンス | Load |
テストタイプマッピング
テストタイプマッピングは、テストタイプとテスト対象のエンティティを DevOps ツール ( モジュールです。
正確なテストタイプマッピングにより、テストタイプがテストサマリー結果に常に意図したとおりに表示されます。
| Field (フィールド) | Description (説明) | |
|---|---|---|
| テストタイプ |
|
|
| DevOps エンティティ ID | テーブル名 | DevOps (テストレポートペイロード内の) テスト結果にリンクされたエンティティを含むテーブル名。
注: DevOpsステップテーブルとパイプラインテーブルのみがサポートされています。 |
| ドキュメント | 選択したテーブルで指定されたエンティティの名前。 たとえば、ステップ、パイプライン、アーティファクト、パッケージの名前などです。 |
|
テストファイルパス (Jenkins テストのみ) |
Jenkins サーバー上で生成されたテスト結果ファイルへのパス。 これは、JUnit や TestNG の実装に準拠しない属性 (たとえば JMeter など) を持つテストレポートを DevOps で活用できるようにするために便利です。 複数のファイルはカンマで区切ります。 注: 生のテストペイロードを変換するには、 ワークフロースタジオ サブフローを使用する必要があります。 |
|
| ツール統合 | テストを実行しているツール。 |
|
| DevOps テーブル | DevOpsDevOps エンティティ ID 設定のテーブル名に対応するテーブル。 |
|
生のテストペイロードの変換
パフォーマンスステージに複数のテストタイプがある場合は、 DevOps テストタイプポリシー ディシジョンテーブルを使用して各テストのテストタイプを構成し、テスト結果のペイロードが正しく変換されるようにすることができます。
| ディシジョンテーブル | 目的 | 構成 |
|---|---|---|
| DevOps テストサブフローポリシー | ツールが受信した生のペイロードを変換するカスタムサブフローを自動的に呼び出すこと。 意思決定の入力:
|
生のペイロードを受信したときに呼び出すカスタムサブフローを指定する意思決定を作成します。 生のペイロードに含まれるフィールドを含む条件を設定します。 たとえば、BZ パフォーマンステスト Jenkins カスタムサブフローを呼び出すには、次のようにします。 Conditions :
解答:フロー: Jenkins BZパフォーマンステスト |
| DevOps テストタイプポリシー | パフォーマンステストステージに複数のタイプのテストが構成されている場合に、テストタイプを自動的に設定すること これは、2 番目のテストタイプの結果を正しく変換するために必要です。 たとえば、ロードパフォーマンステストと JUnit パフォーマンステストの両方が同じ DevOps ステップでマップされている場合、決定が作成されない限り、JUnit テスト結果は正しくフォーマットされません。 意思決定の入力:
|
テストタイプを設定するために、パフォーマンステストステージの各タイプのテストに対する意思決定を作成します。 負荷テスト:
JUnit テスト:
|
テストサマリー結果
- モジュール (テストサマリとパフォーマンステストサマリ)。
- [DevOps 変更要求 :テスト結果] 関連リスト。
- DevOps パイプライン UI - 高品質のタイル。
想定される標準 JSON 通知機能ペイロード:テストツール
{
"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.