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