docs.rs failed to build test-optimization-sdk-0.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Datadog Test Optimization SDK for Rust
This SDK provides integration with Datadog's Test Optimization features for Rust applications.
Features
- Test Session Management
- Test Module Management
- Test Suite Management
- Test Management
- Early Flake Detection
- Auto test retries
- Test Skipping
- Known Tests Tracking
- Flaky Tests Management
- Performance Monitoring with Spans
- Debugging with Mock Tracer
Installation
Add this to your Cargo.toml:
[]
= "0.0.1"
Usage
Initialization
First, initialize the SDK:
use TestOptimization;
// Basic initialization
init;
// Or with a working directory
init_with_working_dir;
// Or with mock tracer for testing
init_mock;
Test Session Management
Create and manage test sessions:
use TestSession;
// Create a new test session
let session = create;
// Set tags
session.set_string_tag;
session.set_number_tag;
// Set error information if needed
session.set_error_info;
// Create a test module
let module = session.create_module;
// Close the session when done
session.close; // 0 for success, non-zero for failure
Test Module Management
Manage test modules within a session:
use TestModule;
// Create a test module (from a session)
let module = session.create_module;
// Set module tags
module.set_string_tag;
module.set_number_tag;
// Create a test suite
let suite = module.create_test_suite;
// Close the module when done
module.close;
Test Suite Management
Manage test suites within a module:
use TestSuite;
// Create a test suite (from a module)
let suite = module.create_test_suite;
// Set suite tags
suite.set_string_tag;
suite.set_number_tag;
// Set source code information
suite.set_test_source;
// Create a test
let test = suite.create_test;
// Close the suite when done
suite.close;
Test Management
Manage individual tests within a suite:
use Test;
// Create a test (from a suite)
let test = suite.create_test;
// Set test tags
test.set_string_tag;
test.set_number_tag;
// Set source code information
test.set_test_source;
// Close the test with status
test.close;
// Or close with skip reason
test.close_with_skip_reason;
Performance Monitoring with Spans
Monitor performance using spans:
use Span;
// Create a new span
let span = create;
// Set span tags
span.set_string_tag;
span.set_number_tag;
// Set error information if needed
span.set_error_info;
// Close the span when done
span.close;
Debugging with Mock Tracer
Use the mock tracer for debugging and testing:
use MockTracer;
// Reset the mock tracer
reset;
// Get all finished spans
let finished_spans = get_finished_spans;
// Get all currently open spans
let open_spans = get_open_spans;
Settings and Configuration
Access and configure various settings:
use TestOptimization;
// Get current settings
let settings = get_settings;
// Get flaky test retry settings
let retry_settings = get_flaky_test_retries_settings;
// Get known tests
let known_tests = get_known_tests;
// Get skippable tests
let skippable_tests = get_skippable_tests;
// Get test management tests
let managed_tests = get_test_management_tests;
Settings Structure
The SDK provides various settings structures for configuration:
Settings
code_coverage: Enable/disable code coverageearly_flake_detection: Early flake detection settingsflaky_test_retries_enabled: Enable/disable flaky test retriesitr_enabled: Enable/disable intelligent test runnerrequire_git: Enable/disable git integrationtests_skipping: Enable/disable test skippingknown_tests_enabled: Enable/disable known tests trackingtest_management: Test management settings
Early Flake Detection Settings
enabled: Enable/disable early flake detectionslow_test_retries: Settings for slow test retriesfaulty_session_threshold: Threshold for faulty session detection
Test Management Settings
enabled: Enable/disable test managementattempt_to_fix_retries: Number of retries for attempt-to-fix operations
Shutdown
When you're done with the SDK, call the shutdown function:
use TestOptimization;
shutdown;
License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.