Test Impact Analysis for Swift
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
Test Impact Analysis is only supported on dd-sdk-swift-testing
in versions 2.2.0
+.
Prior to setting up Test Impact Analysis, set up Test Optimization for Swift. The code coverage option must also be enabled in the test settings of your scheme or test plan, or --enable-code-coverage
must be added to your Swift test command (if using a SPM target).
If you are reporting data through the Agent, use v6.40 and later or v7.40 and later.
あなた、またはあなたの組織で Intelligent Test Runner Activation (intelligent_test_runner_activation_write
) 権限を持つユーザーが、テストサービス設定ページで Test Impact Analysis を有効にする必要があります。
After completing setup, run your tests as you normally do.
You can override the Test Impact Analysis’s 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.
Examples include:
- Tests that read data from text files
- Tests that interact with APIs outside of the code being tested (such as remote REST APIs)
- Tests that run external processes
- Tests that depend on global shared state (for example, caches created by a different test or process)
- Tests that use forked processes (per test code coverage only collects coverage for the main process)
- Integration tests that use capybara or selenium-webdriver
Designating tests as unskippable ensures that Test Impact Analysis runs them regardless of coverage data.
import XCTest
import DatadogSDKTesting
class SomeTestCase: XCTestCase {
func testMethod() {}
}
extension SomeTestCase: ExtendableTaggedType {
static func extendableTypeTags() -> ExtendableTypeTags {
withTagger { tagger in
// Mark all class unskippable
tagger.set(type: .itrSkippable, to: false)
// Set only one method unskippable
tagger.set(instance: .itrSkippable, to: false, method: #selector(testMethod))
}
}
}
Test Impact Analysis can be disabled locally by setting the DD_CIVISIBILITY_ITR_ENABLED
environment variable to false
or 0
.
DD_CIVISIBILITY_ITR_ENABLED
(Optional)- Enable the Test Impact Analysis coverage and test skipping features
Default: (true)