.NET 向け Test Impact Analysis This product is not supported for your selected
Datadog site . (
).
互換性 Test Impact Analysis は dd-trace>= 2.22.0
にのみ対応しています。ツールのバージョンは dd-trace --version
で確認できます。
セットアップ テストの最適化 Test Impact Analysis を設定する前に、.NET 向け Test Optimization をセットアップしてください。Agent 経由でデータを報告する場合は、v6.40 以降または v7.40 以降を使用してください。
テストサービスの Test Impact Analysis を有効にする あなた、またはあなたの組織で Intelligent Test Runner Activation (intelligent_test_runner_activation_write
) 権限を持つユーザーが、テストサービス設定 ページで Test Impact Analysis を有効にする必要があります。
Run tests with Test Impact Analysis enabled セットアップが完了したら、通常どおり dotnet test または VSTest.Console.exe を使用してテストを実行してください。
Copy
dd-trace ci run --dd-service= my-dotnet-app --dd-env= ci -- dotnet test
Copy
dd-trace ci run --dd-service= my-dotnet-app --dd-env= ci -- VSTest.Console.exe { test_assembly} .dll
特定のテストのスキップを無効にする You can override the Test Impact Analysis behavior and prevent specific tests from being skipped. These tests are referred to as unskippable tests.
テストをスキップできないようにする理由は? Test Impact Analysis uses code coverage data to determine whether or not tests should be skipped. In some cases, this data may not be sufficient to make this determination.
例:
テキストファイルからデータを読み込むテスト。 テスト対象のコード以外の API とやりとりするテスト (リモートの REST API など)。 Designating tests as unskippable ensures that Test Impact Analysis runs them regardless of coverage data. Marking tests as unskippable Individual test case テストケースをスキップ不可にするには、XUnit の TraitAttribute
でキー datadog_itr_unskippable
をテストケースに追加します。
using Xunit ;
using Xunit.Abstractions ;
public class MyTestSuite
{
[Fact]
[Trait("datadog_itr_unskippable", null)]
public void MyTest ()
{
// ...
}
}
テストスイート テストスイートをスキップ不可にするには、XUnit の TraitAttribute
でキー datadog_itr_unskippable
をテストスイートに追加します。
If a suite is marked as unskippable, none of the test cases from that suite can be skipped by Test Impact Analysis.
using Xunit ;
using Xunit.Abstractions ;
[Trait("datadog_itr_unskippable", null)]
public class MyTestSuite
{
[Fact]
public void MyTest ()
{
// ...
}
}
Individual test case テストケースをスキップ不可にするには、キー datadog_itr_unskippable
と null ではない値 (例: string.Empty) を持つ NUnit の PropertyAttribute
をテストケースに追加します。
using NUnit.Framework ;
public class MyTestSuite
{
[Test]
[Property("datadog_itr_unskippable", "")]
public void MyTest ()
{
// ...
}
}
テストスイート テストスイートをスキップ不可にするには、キー datadog_itr_unskippable
と null ではない値 (例: string.Empty) を持つ NUnit の PropertyAttribute
をテストスイートに追加します。
If a suite is marked as unskippable, none of the test cases from that suite can be skipped by Test Impact Analysis.
using NUnit.Framework ;
[Property("datadog_itr_unskippable", "")]
public class MyTestSuite
{
[Test]
public void MyTest ()
{
// ...
}
}
Individual test case テストケースをスキップ不可にするには、MsTestV2 の TestPropertyAttribute
でキー datadog_itr_unskippable
をテストケースに追加します。
using Microsoft.VisualStudio.TestTools.UnitTesting ;
[TestClass]
public class MyTestSuite
{
[TestMethod]
[TestProperty("datadog_itr_unskippable", null)]
public void MyTest ()
{
// ...
}
}
その他の参考資料